data

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2021 License: BSD-2-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ForEachBatch

func ForEachBatch(datasetSize, batchSize int, callback func(start, end int))

ForEachBatch divides the dataset into batches, returning the start-end of each batch with a callback. This function assumes that the dataset has already been shuffled.

func GenerateBatches

func GenerateBatches(size, batchFactor int, class func(i int) int) [][]int

GenerateBatches generates a list of batches so that the classes distribution among them is approximately the same. The class is given by the callback for each i-th element up to size. The size of each batch depends on number of classes (batchFactor * nClasses). Each batch consists in a list of indices.

func SplitDataset

func SplitDataset(size int, splitRatio mat.Float, seed uint64, class func(i int) string) (a []int, b []int)

SplitDataset splits the dataset into two parts. Each part consists in a list of indices. The split ratio regulates the percentage of the total assigned to `b` so that `a` contains the rest. For example a split ratio of 0.20 means that `b` should contain the 20% of the total and `a` the rest 80%.

Types

This section is empty.

Jump to

Keyboard shortcuts

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