Example usage for org.apache.mahout.classifier.sgd PassiveAggressive close

List of usage examples for org.apache.mahout.classifier.sgd PassiveAggressive close

Introduction

In this page you can find the example usage for org.apache.mahout.classifier.sgd PassiveAggressive close.

Prototype

@Override
    public void close() 

Source Link

Usage

From source file:opennlp.addons.mahout.PassiveAggressiveTrainer.java

License:Apache License

@Override
public MaxentModel doTrain(DataIndexer indexer) throws IOException {

    // TODO: Lets use the predMap here as well for encoding
    int numberOfOutcomes = indexer.getOutcomeLabels().length;
    int numberOfFeatures = indexer.getPredLabels().length;

    PassiveAggressive pa = new PassiveAggressive(numberOfOutcomes, numberOfFeatures);

    for (int k = 0; k < iterations; k++) {
        trainOnlineLearner(indexer, pa);

        // What should be reported at the end of every iteration ?!
        System.out.println("Iteration " + (k + 1));
    }/*from ww w .  j  a  v  a2 s  . com*/

    pa.close();

    return new VectorClassifierModel(pa, indexer.getOutcomeLabels(), createPrepMap(indexer));
}