gormal

package module
v0.0.0-...-5881f06 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2017 License: MIT Imports: 3 Imported by: 0

README

GoDoc Go Report Card MIT Licence

gormal

a go package for data normalization

Install

go get github.com/frozenkp/gormal

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FeatureScaling

func FeatureScaling(data [][]float64) [][]float64

FeatureScaling normalizes every columns with "feature scaling".

func FeatureScalingSingle

func FeatureScalingSingle(data []float64) []float64

FeatureScalingSingle normalizes the first row with "feature scaling".

(Usually only one row in input)

func StandardScore

func StandardScore(data [][]float64) [][]float64

StandardScore normalizes every columns with "Standard Score".

func StandardScoreSingle

func StandardScoreSingle(data []float64) []float64

StandardScoreSingle normalizes the first row with "Standard Score".

(usually only one row in input)

Types

type CustomData

type CustomData struct {
	RawData Data
}

CustomData is used to call all normalization functions, and you should add your own Data to RawData.

func New

func New(rawData Data) CustomData

New return a CustomData.

func NewFloat64Data

func NewFloat64Data(rawData [][]float64) CustomData

NewFloat64Data return a CustomData with DefaultData.

func NewFloat64DataSingle

func NewFloat64DataSingle(rawData []float64) CustomData

NewFloat64DataSingle return a CustomData with DefaultData.

func (CustomData) FeatureScaling

func (d CustomData) FeatureScaling() [][]float64

FeatureScaling normalizes every columns with "feature scaling".

func (CustomData) FeatureScalingSingle

func (d CustomData) FeatureScalingSingle() []float64

FeatureScalingSingle normalizes the first row with "feature scaling".

(Usually only one row in input)

func (CustomData) StandardScore

func (d CustomData) StandardScore() [][]float64

StandardScore normalizes every columns with "Standard Score".

func (CustomData) StandardScoreSingle

func (d CustomData) StandardScoreSingle() []float64

StandardScoreSingle normalizes the first row with "Standard Score".

(usually only one row in input)

type Data

type Data interface {
	Value(i, j int) float64
	RowSize() int
	ColSize() int
}

Data is a interface for custom data.

You should implement Value(), RowSize(), and ColSize() for your own Data type.

type DefaultData

type DefaultData struct {
	RawData [][]float64
}

DefaultData is used for normal [][]float64 type, and all member functions have been implemented.

func (DefaultData) ColSize

func (d DefaultData) ColSize() int

ColSize is the default ColSize() for DefaultData.

func (DefaultData) RowSize

func (d DefaultData) RowSize() int

RowSize is the default RowSize() for DefaultData.

func (DefaultData) Value

func (d DefaultData) Value(i, j int) float64

Value is the default Value() for DefaultData.

Jump to

Keyboard shortcuts

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