supervised

package
v0.0.0-...-afed897 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2015 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComputeZ

func ComputeZ(weights *util.Matrix, features *util.Vector, label int, temp *util.Matrix) float64

计算 z = 1 + sum(exp(sum(w_i * x_i)))

在temp中保存 exp(sum(w_i * x_i))

func MaxEntComputeInstanceDerivative

func MaxEntComputeInstanceDerivative(
	weights *util.Matrix, instance *data.Instance, instanceDerivative *util.Matrix)

Types

type MaxEntClassifier

type MaxEntClassifier struct {
	NumLabels        int
	FeatureDimension int

	LabelNames        []string
	FeatureDictionary *dictionary.Dictionary
	LabelDictionary   *dictionary.Dictionary

	Weights *util.Matrix
}

最大熵分类器模型

func (*MaxEntClassifier) GetModelType

func (classifier *MaxEntClassifier) GetModelType() string

func (*MaxEntClassifier) Predict

func (classifier *MaxEntClassifier) Predict(instance *data.Instance) data.InstanceOutput

func (*MaxEntClassifier) Write

func (classifier *MaxEntClassifier) Write(path string)

type MaxEntClassifierTrainer

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

最大熵分类训练器

func (*MaxEntClassifierTrainer) Train

func (trainer *MaxEntClassifierTrainer) Train(set data.Dataset) Model

type Model

type Model interface {
	// 返回模型类型,比如"maxent_classifier"
	GetModelType() string

	// 将模型写入文件
	Write(path string)

	// 预测样本的输出
	Predict(instance *data.Instance) data.InstanceOutput
}

训练得到的机器学习模型

func LoadModel

func LoadModel(path string) Model

type Trainer

type Trainer interface {
	// 在数据集上进行训练,得到模型
	Train(set data.Dataset) Model
}

func NewMaxEntClassifierTrainer

func NewMaxEntClassifierTrainer(options TrainerOptions) Trainer

创建一个最大熵分类训练器

type TrainerOptions

type TrainerOptions struct {
	// 优化器选项
	Optimizer optimizer.OptimizerOptions

	// 其它自定义选项
	Options interface{}
}

训练器选项

Jump to

Keyboard shortcuts

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