ML

package module
v0.0.0-...-afb026f Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2013 License: Apache-2.0 Imports: 13 Imported by: 0

README

MLiG

Machine Learning in Go

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EntropyAccumulatorFactory

func EntropyAccumulatorFactory(categoryValueCount int) func() CVAccumulator

func NewTreeNode

func NewTreeNode(statistics CVAccumulator) *treeNode

func ShuffleData

func ShuffleData(data []*Data)

func StatAccumulatorFactory

func StatAccumulatorFactory() func() CVAccumulator

func TrainBag

func TrainBag(data []*Data, classifier Classifier)

Types

type CVAccumulator

type CVAccumulator interface {
	ErrorAccumulator
	Remove(float64)
	Metric() float64
}

type Classifier

type Classifier interface {
	Classify(func(int32) float64) CVAccumulator
	Train(trainset []*Data)

	// Accumulate statistics for this classifier
	Add(error float64)
	// Return an error estimate
	Estimate() float64
}

type Data

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

func CSVData

func CSVData(legend string, filename string, outputCategories, skip int) []*Data

func DigitData

func DigitData(filename string) []*Data

func GlassData

func GlassData(filename string) []*Data

func (*Data) AppendFeatures

func (d *Data) AppendFeatures(af []float64)

func (*Data) Features

func (d *Data) Features() []float64

type Ensemble

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

func NewEnsemble

func NewEnsemble() *Ensemble

func (*Ensemble) AddClassifier

func (te *Ensemble) AddClassifier(newClassifier Classifier)

func (*Ensemble) Error

func (te *Ensemble) Error(data []*Data) float64

type EntropyAccumulator

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

func NewEntropyAccumulator

func NewEntropyAccumulator(categoryValueCount int) *EntropyAccumulator

func (*EntropyAccumulator) Add

func (ea *EntropyAccumulator) Add(category float64)

func (*EntropyAccumulator) Clear

func (ea *EntropyAccumulator) Clear()

func (*EntropyAccumulator) Clone

func (*EntropyAccumulator) Count

func (ea *EntropyAccumulator) Count() int

func (*EntropyAccumulator) Dump

func (ea *EntropyAccumulator) Dump(w io.Writer, indent int)

func (*EntropyAccumulator) Estimate

func (ea *EntropyAccumulator) Estimate() float64

func (*EntropyAccumulator) FrequencyEstimate

func (ea *EntropyAccumulator) FrequencyEstimate(value float64) float64

func (*EntropyAccumulator) Metric

func (ea *EntropyAccumulator) Metric() float64

func (*EntropyAccumulator) Remove

func (ea *EntropyAccumulator) Remove(category float64)

func (EntropyAccumulator) String

func (ea EntropyAccumulator) String() string

type ErrorAccumulator

type ErrorAccumulator interface {
	Clear()
	Add(float64)
	Count() int
	Estimate() float64
	Clone() ErrorAccumulator
	Dump(io.Writer, int)
}

type Feature

type Feature interface {
	// contains filtered or unexported methods
}

type FeatureType

type FeatureType int
const (
	CATEGORICAL FeatureType = iota
	CONTINUOUS
)

type GrayWithFeatures

type GrayWithFeatures struct {
	*image.Gray
	// contains filtered or unexported fields
}

func (*GrayWithFeatures) Centroid

func (gwf *GrayWithFeatures) Centroid() (x, y float64)

func (*GrayWithFeatures) Edges

func (gwf *GrayWithFeatures) Edges() (vertical, horizontal float64)

imageEdges returns the average number of vertical and horizontal edges in the image. For vertical edges the average is taken over all rows. For horizontal edges the average is taken over all columns.

func (*GrayWithFeatures) Mass

func (gwf *GrayWithFeatures) Mass() float64

func (*GrayWithFeatures) Moments

func (gwf *GrayWithFeatures) Moments() (rxx, ryy, rxy float64)

func (*GrayWithFeatures) RandomFeature

func (gwf *GrayWithFeatures) RandomFeature(s int32) float64

type HierarchicalFeatures

type HierarchicalFeatures struct {
	*image.Gray
	// contains filtered or unexported fields
}

func NewHierarchicalFeatures

func NewHierarchicalFeatures(gs *image.Gray) *HierarchicalFeatures

func (*HierarchicalFeatures) Centroid

func (hf *HierarchicalFeatures) Centroid(r image.Rectangle) (xBar, yBar float64)

func (*HierarchicalFeatures) Dump

func (hf *HierarchicalFeatures) Dump(w io.Writer)

func (*HierarchicalFeatures) Edges

func (hf *HierarchicalFeatures) Edges(r image.Rectangle) (horizEdges, vertEdges float64)

func (*HierarchicalFeatures) MassSums

func (hf *HierarchicalFeatures) MassSums(r image.Rectangle) (mass, xMass, yMass int32, x2Mass, y2Mass, xyMass int64)

func (*HierarchicalFeatures) RandomFeature

func (hf *HierarchicalFeatures) RandomFeature(s int32) float64

type RandomFeatureSelector

type RandomFeatureSelector interface {
	RandomFeature(s int32) float64
}

type SplitInfo

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

func (*SplitInfo) String

func (si *SplitInfo) String() string

type StatAccumulator

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

A new StatAccumulator may be declared without initialization. The Go default initialization is correct.

func (*StatAccumulator) Add

func (sa *StatAccumulator) Add(x float64)

func (*StatAccumulator) Clear

func (sa *StatAccumulator) Clear()

func (*StatAccumulator) Clone

func (sa *StatAccumulator) Clone() ErrorAccumulator

func (*StatAccumulator) Count

func (sa *StatAccumulator) Count() int

func (*StatAccumulator) Dump

func (sa *StatAccumulator) Dump(w io.Writer, indent int)

func (*StatAccumulator) Estimate

func (sa *StatAccumulator) Estimate() float64

func (*StatAccumulator) Metric

func (sa *StatAccumulator) Metric() float64

func (*StatAccumulator) Remove

func (sa *StatAccumulator) Remove(x float64)

type Tree

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

func NewTree

func NewTree(accumulatorFactory func() CVAccumulator) *Tree

func (*Tree) Add

func (tree *Tree) Add(error float64)

func (*Tree) Classify

func (tree *Tree) Classify(featureSelector func(int32) float64) CVAccumulator

func (*Tree) Depth

func (tree *Tree) Depth() int

func (*Tree) Dump

func (tree *Tree) Dump(w io.Writer)

func (*Tree) Estimate

func (tree *Tree) Estimate() float64

func (*Tree) Leaves

func (tree *Tree) Leaves() int

func (*Tree) SetFeaturesToTry

func (tree *Tree) SetFeaturesToTry(n int)

func (*Tree) SetMaxDepth

func (tree *Tree) SetMaxDepth(depth int)

func (*Tree) SetMinLeafSize

func (tree *Tree) SetMinLeafSize(size int)

func (*Tree) Size

func (tree *Tree) Size() int

func (*Tree) Train

func (tree *Tree) Train(trainingSet []*Data)

type WeightedCVAccumulator

type WeightedCVAccumulator interface {
	WeightedErrorAccumulator
	Remove(cateogry, weight float64)
	Metric() float64
}

type WeightedErrorAccumulator

type WeightedErrorAccumulator interface {
	Clear()
	Add(category, weight float64)
	Count() int
	WeightedCount() float64
	Estimate() float64
	Clone() WeightedErrorAccumulator
	Dump(io.Writer, int)
}

Jump to

Keyboard shortcuts

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