public class PerceptronClassifier extends Object implements org.maochen.nlp.ml.IClassifier
| Modifier and Type | Field and Description |
|---|---|
protected PerceptronModel |
model |
| Constructor and Description |
|---|
PerceptronClassifier() |
| Modifier and Type | Method and Description |
|---|---|
void |
loadModel(InputStream inputStream) |
void |
onlineTrain(double[] x,
int labelIndex)
public use for doing one training sample.
|
void |
persistModel(String modelFile) |
Map<String,Double> |
predict(org.maochen.nlp.ml.Tuple predict)
Do a prediction.
|
void |
setParameter(Properties props) |
org.maochen.nlp.ml.IClassifier |
train(List<org.maochen.nlp.ml.Tuple> trainingData) |
protected PerceptronModel model
public void onlineTrain(double[] x,
int labelIndex)
x - Feature VectorlabelIndex - label's index, from PerceptronModel.LabelIndexerpublic org.maochen.nlp.ml.IClassifier train(List<org.maochen.nlp.ml.Tuple> trainingData)
train in interface org.maochen.nlp.ml.IClassifierpublic Map<String,Double> predict(org.maochen.nlp.ml.Tuple predict)
predict in interface org.maochen.nlp.ml.IClassifierpredict - predict tuple.public void setParameter(Properties props)
setParameter in interface org.maochen.nlp.ml.IClassifierpublic void persistModel(String modelFile) throws IOException
persistModel in interface org.maochen.nlp.ml.IClassifierIOExceptionpublic void loadModel(InputStream inputStream)
loadModel in interface org.maochen.nlp.ml.IClassifierCopyright © 2016. All rights reserved.