meta

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: 56

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaggedModel

type BaggedModel struct {
	base.BaseClassifier
	Models         []base.Classifier
	RandomFeatures int
	// contains filtered or unexported fields
}

BaggedModel trains base.Classifiers on subsets of the original Instances and combine the results through voting

func (*BaggedModel) AddModel

func (b *BaggedModel) AddModel(m base.Classifier)

AddModel adds a base.Classifier to the current model

func (*BaggedModel) Fit

func (b *BaggedModel) Fit(from base.FixedDataGrid)

Fit generates and trains each model on a randomised subset of Instances.

func (*BaggedModel) GetMetadata

func (b *BaggedModel) GetMetadata() base.ClassifierMetadataV1

GetMetadata returns required serialization information for this classifier

func (*BaggedModel) Load

func (b *BaggedModel) Load(filePath string) error

func (*BaggedModel) LoadWithPrefix

func (b *BaggedModel) LoadWithPrefix(reader *base.ClassifierDeserializer, prefix string) error

Remember: have to add the models before you use this.

func (*BaggedModel) Predict

func (b *BaggedModel) Predict(from base.FixedDataGrid) (base.FixedDataGrid, error)

Predict gathers predictions from all the classifiers and outputs the most common (majority) class

IMPORTANT: in the event of a tie, the first class which achieved the tie value is output.

func (*BaggedModel) Save

func (b *BaggedModel) Save(filePath string) error

func (*BaggedModel) SaveWithPrefix

func (b *BaggedModel) SaveWithPrefix(writer *base.ClassifierSerializer, prefix string) error
 type BaggedModel struct {
	base.BaseClassifier
	Models             []base.Classifier
	RandomFeatures     int
	lock               sync.Mutex
	selectedAttributes map[int][]base.Attribute, always RandomFeatures in length
}

func (*BaggedModel) String

func (b *BaggedModel) String() string

String returns a human-readable representation of the BaggedModel and everything it contains

type OneVsAllModel

type OneVsAllModel struct {
	NewClassifierFunction func(string) base.Classifier
	// contains filtered or unexported fields
}

OneVsAllModel replaces class Attributes with numeric versions and trains n wrapped classifiers. The actual class is chosen by whichever is most confident. Only one CategoricalAttribute class variable is supported.

func NewOneVsAllModel

func NewOneVsAllModel(f func(string) base.Classifier) *OneVsAllModel

NewOneVsAllModel creates a new OneVsAllModel. The argument must be a function which returns a base.Classifier ready for training.

func (*OneVsAllModel) Fit

func (m *OneVsAllModel) Fit(using base.FixedDataGrid)

Fit creates n filtered datasets (where n is the number of values a CategoricalAttribute can take) and uses them to train the underlying classifiers.

func (*OneVsAllModel) GetMetadata

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

func (*OneVsAllModel) Load

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

func (*OneVsAllModel) LoadWithPrefix

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

func (*OneVsAllModel) Predict

Predict issues predictions. Each class-specific classifier is expected to output a value between 0 (indicating that a given instance is not a given class) and 1 (indicating that the given instance is definitely that class). For each instance, the class with the highest value is chosen. The result is undefined if several underlying models output the same value.

func (*OneVsAllModel) Save

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

func (*OneVsAllModel) SaveWithPrefix

func (m *OneVsAllModel) SaveWithPrefix(writer *base.ClassifierSerializer, prefix string) error

Jump to

Keyboard shortcuts

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