datasets

package
v1.6.2 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apply

func Apply(dataset []DataPoint, f func([]float64) []float64)

func Categorize

func Categorize(entries []FrameEntry) (newColumn []FrameEntry, options []FrameEntry)

func FromOneHot

func FromOneHot(output []float64) int

func GetInputs added in v1.3.0

func GetInputs(dataset []DataPoint) (inputs [][]float64)

func GetMean

func GetMean(dataset []DataPoint, sampleSize int) []float64

func GetOutputs added in v1.3.0

func GetOutputs(dataset []DataPoint) (outputs [][]float64)

func IsCorrect

func IsCorrect(output []float64, target []float64)

func NormalizeInputs

func NormalizeInputs(dataset []DataPoint)

func SaveDataset

func SaveDataset(dataset []DataPoint, dir string, name string)

func Split added in v1.3.0

func Split(dataset []DataPoint) (inputs [][]float64, outputs [][]float64)

func ToOneHot

func ToOneHot(value int, maxValue int) []float64

Types

type DataFrame

type DataFrame struct {
	// contains filtered or unexported fields
}

func ReadCSV

func ReadCSV(path string, headers bool) DataFrame

Reads a csv at the given path into a DataFrame. The headers argument is a boolean representing if the first row in the dataset is just the headers for the columns. This should usually be set to true.

func (*DataFrame) AddColumn added in v1.3.0

func (frame *DataFrame) AddColumn(header string, values []float64)

func (*DataFrame) CategorizeColumn

func (frame *DataFrame) CategorizeColumn(title string) (options []FrameEntry)

func (*DataFrame) CategorizeColumnSlice

func (frame *DataFrame) CategorizeColumnSlice(colSlice string) (options [][]FrameEntry)

func (*DataFrame) CategorizeNthColumn

func (frame *DataFrame) CategorizeNthColumn(col int) (options []FrameEntry)

func (*DataFrame) ClampColumn added in v1.3.0

func (frame *DataFrame) ClampColumn(title string, newMin float64, newMax float64) (float64, float64)

func (*DataFrame) ClampColumnSlice added in v1.3.0

func (frame *DataFrame) ClampColumnSlice(colSlice string, newMin float64, newMax float64) (mins []float64, maxes []float64)

func (*DataFrame) ClampNthColumn added in v1.3.0

func (frame *DataFrame) ClampNthColumn(col int, newMin float64, newMax float64) (float64, float64)

func (*DataFrame) Cols

func (frame *DataFrame) Cols() int

func (*DataFrame) DeleteColumnSlice added in v1.3.0

func (frame *DataFrame) DeleteColumnSlice(sliceString string)

func (*DataFrame) DeleteColumns

func (frame *DataFrame) DeleteColumns(headers ...string)

func (*DataFrame) DeleteRows

func (frame *DataFrame) DeleteRows(sliceString string)

func (*DataFrame) Dims

func (frame *DataFrame) Dims() (int, int)

func (*DataFrame) GetCol

func (frame *DataFrame) GetCol(title string) []FrameEntry

func (*DataFrame) GetNthCol

func (frame *DataFrame) GetNthCol(col int) []FrameEntry

func (*DataFrame) MapFloatColumn

func (frame *DataFrame) MapFloatColumn(title string, lambda func(int, float64) float64)

func (*DataFrame) MapFloatColumnSlice

func (frame *DataFrame) MapFloatColumnSlice(colSlice string, lambda func(int, float64) float64)

func (*DataFrame) MapNthFloatColumn

func (frame *DataFrame) MapNthFloatColumn(col int, lambda func(int, float64) float64)

func (*DataFrame) MapNthStringColumn

func (frame *DataFrame) MapNthStringColumn(col int, lambda func(string) string)

func (*DataFrame) MapStringColumn

func (frame *DataFrame) MapStringColumn(title string, lambda func(string) string)

func (*DataFrame) MapStringColumnSlice

func (frame *DataFrame) MapStringColumnSlice(colSlice string, lambda func(string) string)

func (*DataFrame) NormalizeColumn

func (frame *DataFrame) NormalizeColumn(title string) (float64, float64)

func (*DataFrame) NormalizeColumnSlice

func (frame *DataFrame) NormalizeColumnSlice(colSlice string) (means []float64, stddevs []float64)

func (*DataFrame) NormalizeNthColumn

func (frame *DataFrame) NormalizeNthColumn(col int) (float64, float64)

func (*DataFrame) NumericallyCategorizeColumn

func (frame *DataFrame) NumericallyCategorizeColumn(title string)

func (*DataFrame) NumericallyCategorizeColumnSlice

func (frame *DataFrame) NumericallyCategorizeColumnSlice(colSlice string)

func (*DataFrame) NumericallyCategorizeNthColumn

func (frame *DataFrame) NumericallyCategorizeNthColumn(col int)

func (*DataFrame) OverwriteColumn

func (frame *DataFrame) OverwriteColumn(newColumn []FrameEntry, title string)

func (*DataFrame) OverwriteNthColumn

func (frame *DataFrame) OverwriteNthColumn(newColumn []FrameEntry, col int)

func (*DataFrame) PrintSummary

func (frame *DataFrame) PrintSummary()

func (*DataFrame) Rows

func (frame *DataFrame) Rows() int

func (*DataFrame) SelectColumns

func (frame *DataFrame) SelectColumns(sliceString string) (selectedFrame DataFrame)

func (*DataFrame) SelectRowSlice added in v1.3.0

func (frame *DataFrame) SelectRowSlice(sliceString string) (selectedFrame DataFrame)

func (*DataFrame) SelectRowsMatching added in v1.3.0

func (frame *DataFrame) SelectRowsMatching(header string, entry FrameEntry) (selectedFrame DataFrame)

func (*DataFrame) ShuffleRows

func (frame *DataFrame) ShuffleRows()

func (*DataFrame) ToDataset

func (frame *DataFrame) ToDataset(inputSlice string, outputSlice string) []DataPoint

func (*DataFrame) ToLSTMDataset added in v1.4.0

func (frame *DataFrame) ToLSTMDataset(inputSlice string, outputSlice string) []DataPoint

func (*DataFrame) ToSequentialDataset added in v1.3.0

func (frame *DataFrame) ToSequentialDataset(inputSlice string, outputSlice string, intervalLength int) []DataPoint

type DataPoint

type DataPoint struct {
	Input  []float64
	Output []float64
}

func DataPointFromBytes

func DataPointFromBytes(bytes []byte, inputLength int) DataPoint

func OpenDataset

func OpenDataset(dir string, name string) []DataPoint

func (*DataPoint) ToBytes

func (dp *DataPoint) ToBytes() []byte

type FrameEntry

type FrameEntry interface {
	FullValue() string
	DisplayValue() string
	Equals(FrameEntry) bool

	MergeInto([]float64) []float64
}

func CreateEntry

func CreateEntry(rawValue string) FrameEntry

func NumericallyCategorize

func NumericallyCategorize(entries []FrameEntry) (newColumn []FrameEntry)

type NumberEntry

type NumberEntry struct {
	Value float64
}

func (*NumberEntry) DisplayValue

func (flt *NumberEntry) DisplayValue() string

func (*NumberEntry) Equals

func (flt *NumberEntry) Equals(other FrameEntry) bool

func (*NumberEntry) FullValue

func (flt *NumberEntry) FullValue() string

func (*NumberEntry) MergeInto

func (flt *NumberEntry) MergeInto(vals []float64) []float64

type StringEntry

type StringEntry struct {
	Value string
}

func (*StringEntry) DisplayValue

func (str *StringEntry) DisplayValue() string

func (*StringEntry) Equals

func (str *StringEntry) Equals(other FrameEntry) bool

func (*StringEntry) FullValue

func (str *StringEntry) FullValue() string

func (*StringEntry) MergeInto

func (str *StringEntry) MergeInto(_ []float64) []float64

type VectorEntry

type VectorEntry struct {
	Value []float64
}

func (*VectorEntry) DisplayValue

func (vec *VectorEntry) DisplayValue() string

func (*VectorEntry) Equals

func (vec *VectorEntry) Equals(other FrameEntry) bool

func (*VectorEntry) FullValue

func (vec *VectorEntry) FullValue() string

func (*VectorEntry) MergeInto

func (vec *VectorEntry) MergeInto(vals []float64) []float64

Jump to

Keyboard shortcuts

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