|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.mahout.classifier.discriminative.LinearTrainer
public abstract class LinearTrainer
Implementors of this class need to provide a way to train linear discriminative classifiers. As this is just the reference implementation we assume that the dataset fits into main memory - this should be the first thing to change when switching to Hadoop.
| Constructor Summary | |
|---|---|
protected |
LinearTrainer(int dimension,
double threshold,
double init,
double initBias)
Initialize the trainer. |
| Method Summary | |
|---|---|
LinearModel |
getModel()
Retrieves the trained model if called after train, otherwise the raw model. |
void |
train(Vector labelset,
Matrix dataset)
Initializes training. |
protected abstract void |
update(double label,
Vector dataPoint,
LinearModel model)
Implement this method to match your training strategy. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
protected LinearTrainer(int dimension,
double threshold,
double init,
double initBias)
dimension - number of expected features.threshold - threshold to use for classification.init - initial value of weight vector.initBias - initial classification bias.| Method Detail |
|---|
public void train(Vector labelset,
Matrix dataset)
throws TrainingException
dataset - the dataset to train on. Each column is treated as point.labelset - the set of labels, one for each data point. If the cardinalities
of data- and labelset do not match, a CardinalityException is
thrown
TrainingExceptionpublic LinearModel getModel()
protected abstract void update(double label,
Vector dataPoint,
LinearModel model)
model - the model to update.label - the target label of the wrongly classified data point.dataPoint - the data point that was classified incorrectly.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||