public static class SVM.Trainer<T> extends ClassifierTrainer<T>
| Constructor and Description |
|---|
SVM.Trainer(MercerKernel<T> kernel,
double C)
Constructor of trainer for binary SVMs.
|
SVM.Trainer(MercerKernel<T> kernel,
double Cp,
double Cn)
Constructor of trainer for binary SVMs.
|
SVM.Trainer(MercerKernel<T> kernel,
double C,
double[] weight,
SVM.Multiclass strategy)
Constructor of trainer for multi-class SVMs.
|
SVM.Trainer(MercerKernel<T> kernel,
double C,
int k,
SVM.Multiclass strategy)
Constructor of trainer for multi-class SVMs.
|
| Modifier and Type | Method and Description |
|---|---|
void |
setNumEpochs(int epochs)
Sets the number of epochs of stochastic learning.
|
void |
setTolerance(double tol)
Sets the tolerance of convergence test.
|
SVM<T> |
train(T[] x,
int[] y)
Learns a classifier with given training data.
|
SVM<T> |
train(T[] x,
int[] y,
double[] weight)
Learns a SVM classifier with given training data.
|
setAttributespublic SVM.Trainer(MercerKernel<T> kernel, double C)
kernel - the kernel function.C - the soft margin penalty parameter.public SVM.Trainer(MercerKernel<T> kernel, double Cp, double Cn)
kernel - the kernel function.Cp - the soft margin penalty parameter for positive instances.Cn - the soft margin penalty parameter for negative instances.public SVM.Trainer(MercerKernel<T> kernel, double C, int k, SVM.Multiclass strategy)
kernel - the kernel function.C - the soft margin penalty parameter.k - the number of classes.public SVM.Trainer(MercerKernel<T> kernel, double C, double[] weight, SVM.Multiclass strategy)
kernel - the kernel function.C - the soft margin penalty parameter.weight - class weight. Must be positive. The soft margin penalty
of class i will be weight[i] * C.public void setTolerance(double tol)
tol - the tolerance of convergence test.public void setNumEpochs(int epochs)
epochs - the number of epochs of stochastic learning.public SVM<T> train(T[] x, int[] y)
ClassifierTrainertrain in class ClassifierTrainer<T>x - the training instances.y - the training labels.public SVM<T> train(T[] x, int[] y, double[] weight)
x - training instances.y - training labels in [0, k), where k is the number of classes.weight - instance weight. Must be positive. The soft margin penalty
for instance i will be weight[i] * C.Copyright © 2015. All rights reserved.