utils

package
v0.0.0-...-0d9dfb7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 17, 2018 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateClusters

func GenerateClusters(rows, cols, clusters int, max, min, maxOffset float64, randSeed int64) *mat.Dense

GenerateClusters generates random data samples clustered in the given number of clusters. The samples are located in a hypercube given by the max and min parameters. The clusters are hypercubes (not hyperspheres) around randomly picked cluster centres. There is the same number of data samples in each cluster (rows/clusters) rows - how many data rows to generate cols - dimension of data clusters - how many clusters max,min - maximum and minimum coordinates (applies to all dimensions) maxOffset - this is the maximum distance of a sample from its cluster centre in any dimension. randSeed - random seed

func IntCumProduct

func IntCumProduct(vector []int) []int

IntCumProduct calculates a cumulative product of all items in slice as a parameter and returns it in a new slice. The origin slice remains unmodified It returns empty slice if either the supplied slice is empty or nil

func IntProduct

func IntProduct(vector []int) int

IntProduct calculates a product of all items in slice passed in as a parameter It returns 1.0 if the slice is nil or empty.

func ParseDims

func ParseDims(dimString string) ([]int, error)

ParseDims expects a string that contains comma-separated integer values. It tries to convert the parameters to their numerical values and returns them. If empty string is supplied, it allocates 2-dims slice and returns it. It returns error if a non-empty string is passed in as a parameter and the values it contains can not be converted to integers.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL