dataset

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: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// LrnHeaderSize holds the size of LRN file header
	LrnHeaderSize = iota
	// LrnHeaderCols holds number of LRN header columns
	LrnHeaderCols
	// LrnHeaderTypes holds number of LRN types
	LrnHeaderTypes
	// LrnHeaderNames not used
	LrnHeaderNames
	// LrnHeaderRows holds number of LRN header rows
	LrnHeaderRows
)

LRN data format constants

Variables

This section is empty.

Functions

func LoadCLS

func LoadCLS(reader io.Reader) (map[int]int, error)

LoadCLS reads classification information from a .cls file. See the specification here: http://databionic-esom.sourceforge.net/user.html#Classification_files____cls_ The only supported header is the Number of datasets (n)

func LoadCSV

func LoadCSV(r io.Reader) (*mat.Dense, error)

LoadCSV loads data set from the path supplied as a parameter. It returns data matrix that contains particular CSV fields in columns. It returns error if the supplied data set contains corrrupted data or if the data can not be converted to float numbers

func LoadLRN

func LoadLRN(reader io.Reader) (*mat.Dense, error)

LoadLRN reads data from a .lrn file. See the specification here: http://databionic-esom.sourceforge.net/user.html#Data_files____lrn_

func Scale

func Scale(mx mat.Matrix) *mat.Dense

Scale centers the data set to zero mean values in each column and then normalizes them. It does not modify the data stored in the matrix supplied as a parameter.

Types

type DataSet

type DataSet struct {
	Data    *mat.Dense
	Classes map[int]int
}

DataSet represents training data set

func New

func New(dataPath string, clsPath string) (*DataSet, error)

New returns pointer to dataset or fails with error if either the file in dataPath does not exist or if it is encoded in an unsupported format. File format is inferred from the file extension. Currently only csv and lrn data formats are supported. If the dataset has classification information it can be provided as the second parameter. If the file in clsPath doesn't exist New fails with error.

func (*DataSet) Scale

func (ds *DataSet) Scale() *mat.Dense

Scale normalizes data in each column based on its mean and standard deviation and returns it. It modifies the underlying daata. If this is not desirable use the standalone Scale function.

Jump to

Keyboard shortcuts

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