classification

package
v3.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterClassificationPreload

func RegisterClassificationPreload(v *vm.VM)

Types

type Class

type Class string

type Classifier

type Classifier struct {
	Classes []Class

	DidConvertTfIdf bool
	// contains filtered or unexported fields
}

func NewClassifier

func NewClassifier(classes ...Class) *Classifier

func NewClassifierTfIdf

func NewClassifierTfIdf(classes ...Class) *Classifier

func (*Classifier) Classify

func (c *Classifier) Classify(document []string) (Class, []float64, bool)

func (*Classifier) ClassifyProb

func (c *Classifier) ClassifyProb(document []string) (Class, []float64, bool)

func (*Classifier) ConvertTermsFreqToTfIdf

func (c *Classifier) ConvertTermsFreqToTfIdf()

func (*Classifier) Learn

func (c *Classifier) Learn(document []string, which Class)

func (*Classifier) Learned

func (c *Classifier) Learned() int

func (*Classifier) LogScores

func (c *Classifier) LogScores(document []string) ([]float64, int, bool)

func (*Classifier) ProbScores

func (c *Classifier) ProbScores(doc []string) ([]float64, int, bool)

type KNN

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

func NewKNN

func NewKNN(k int) *KNN

func (*KNN) Fit

func (m *KNN) Fit(features [][]float64, labels []string)

func (*KNN) Predict

func (m *KNN) Predict(x []float64) string

type LogisticRegression

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

func NewLogisticRegression

func NewLogisticRegression(lr float64, epochs int) *LogisticRegression

func (*LogisticRegression) Fit

func (m *LogisticRegression) Fit(features [][]float64, labels []string)

func (*LogisticRegression) Predict

func (m *LogisticRegression) Predict(x []float64) string

func (*LogisticRegression) PredictProba

func (m *LogisticRegression) PredictProba(x []float64) float64

type Perceptron

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

func NewPerceptron

func NewPerceptron(lr float64, epochs int) *Perceptron

func (*Perceptron) Fit

func (p *Perceptron) Fit(features [][]float64, labels []string)

func (*Perceptron) Predict

func (p *Perceptron) Predict(x []float64) string

type SVM

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

func NewSVM

func NewSVM(cfg SVMConfig) *SVM

func (*SVM) DecisionFunction

func (s *SVM) DecisionFunction(x []float64) float64

func (*SVM) Fit

func (s *SVM) Fit(features [][]float64, labels []string)

func (*SVM) Predict

func (s *SVM) Predict(x []float64) string

func (*SVM) SupportVectorCount

func (s *SVM) SupportVectorCount() int

type SVMConfig

type SVMConfig struct {
	Kernel  SVMKernel
	Gamma   float64
	Coef0   float64
	Degree  int
	C       float64
	Tol     float64
	MaxIter int
	Seed    int64
}

type SVMKernel

type SVMKernel int
const (
	KernelLinear SVMKernel = iota
	KernelRBF
	KernelPoly
)

func ParseKernel

func ParseKernel(s string) SVMKernel

Jump to

Keyboard shortcuts

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