1
0
mirror of https://github.com/sjwhitworth/golearn.git synced 2025-04-26 13:49:14 +08:00
golearn/base/classifier.go
Richard Townsend ff52c013eb Update gonum to latest version
Should fix #200 and #205
2018-03-24 00:19:35 +00:00

44 lines
1.2 KiB
Go

package base
import (
"gonum.org/v1/gonum/mat"
)
// Classifier implementations predict categorical class labels.
type Classifier interface {
// Takes a set of Instances, copies the class Attribute
// and constructs a new set of Instances of equivalent
// length with only the class Attribute and fills it in
// with predictions.
Predict(FixedDataGrid) (FixedDataGrid, error)
// Takes a set of instances and updates the Classifier's
// internal structures to enable prediction
Fit(FixedDataGrid) error
// Why not make every classifier return a nice-looking string?
String() string
// Save the classifier to a file
Save(string) error
// Read recreates the classifier from a file
Load(string) error
// Retrieves the metadata associated with this classifer
// (required for Ensembles)
GetMetadata() ClassifierMetadataV1
// Used when something is saved as part of an ensemble
SaveWithPrefix(*ClassifierSerializer, string) error
LoadWithPrefix(*ClassifierDeserializer, string) error
}
// BaseClassifier stores options common to every classifier.
type BaseClassifier struct {
TrainingData *DataGrid
}
type BaseRegressor struct {
Data mat.Dense
Name string
Labels []float64
}