ensemble

package
v0.0.0-...-74ae077 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2022 License: MIT Imports: 6 Imported by: 99

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MultiLinearSVC

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

MultiLinearSVC implements a multi-class Support Vector Classifier using a one-vs-all voting scheme. Only one CategoricalAttribute class is supported.

func NewMultiLinearSVC

func NewMultiLinearSVC(loss, penalty string, dual bool, C float64, eps float64, weights map[string]float64) *MultiLinearSVC

NewMultiLinearSVC creates a new MultiLinearSVC using the OneVsAllModel. The loss and penalty arguments can be "l1" or "l2". Typical values are "l1" for the loss and "l2" for the penalty. The dual parameter controls whether the system solves the dual or primal SVM form, true should be used in most cases. C is the penalty term, normally 1.0. eps is the convergence term, typically 1e-4.

func (*MultiLinearSVC) Fit

func (m *MultiLinearSVC) Fit(instances base.FixedDataGrid) error

Fit builds the MultiLinearSVC by building n (where n is the number of values the singular CategoricalAttribute can take) seperate one-vs-rest models.

func (*MultiLinearSVC) GetClassifierMetadata

func (m *MultiLinearSVC) GetClassifierMetadata() base.ClassifierMetadataV1

func (*MultiLinearSVC) GetMetadata

func (m *MultiLinearSVC) GetMetadata() base.ClassifierMetadataV1

func (*MultiLinearSVC) Load

func (m *MultiLinearSVC) Load(filePath string) error

func (*MultiLinearSVC) LoadWithPrefix

func (m *MultiLinearSVC) LoadWithPrefix(reader *base.ClassifierDeserializer, prefix string) error

func (*MultiLinearSVC) Predict

Predict issues predictions from the MultiLinearSVC. Each underlying LinearSVC is used to predict whether an instance takes on a class or some other class, and the model which definitively reports a given class is the one chosen. The result is undefined if all underlying models predict that the instance originates from some other class.

func (*MultiLinearSVC) Save

func (m *MultiLinearSVC) Save(filePath string) error

func (*MultiLinearSVC) SaveWithPrefix

func (m *MultiLinearSVC) SaveWithPrefix(serializer *base.ClassifierSerializer, prefix string) error

type RandomForest

type RandomForest struct {
	base.BaseClassifier
	ForestSize int
	Features   int
	Model      *meta.BaggedModel
}

RandomForest classifies instances using an ensemble of bagged random decision trees.

func NewRandomForest

func NewRandomForest(forestSize int, features int) *RandomForest

NewRandomForest generates and return a new random forests forestSize controls the number of trees that get built features controls the number of features used to build each tree.

func (*RandomForest) Fit

func (f *RandomForest) Fit(on base.FixedDataGrid) error

Fit builds the RandomForest on the specified instances

func (*RandomForest) GetMetadata

func (f *RandomForest) GetMetadata() base.ClassifierMetadataV1

func (*RandomForest) Load

func (f *RandomForest) Load(filePath string) error

func (*RandomForest) LoadWithPrefix

func (f *RandomForest) LoadWithPrefix(reader *base.ClassifierDeserializer, prefix string) error

func (*RandomForest) Predict

func (f *RandomForest) Predict(with base.FixedDataGrid) (base.FixedDataGrid, error)

Predict generates predictions from a trained RandomForest.

func (*RandomForest) Save

func (f *RandomForest) Save(filePath string) error

func (*RandomForest) SaveWithPrefix

func (f *RandomForest) SaveWithPrefix(writer *base.ClassifierSerializer, prefix string) error

func (*RandomForest) String

func (f *RandomForest) String() string

String returns a human-readable representation of this tree.

Jump to

Keyboard shortcuts

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