Example usage for org.apache.mahout.classifier.sgd CsvRecordFactory CsvRecordFactory

List of usage examples for org.apache.mahout.classifier.sgd CsvRecordFactory CsvRecordFactory

Introduction

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

Prototype

public CsvRecordFactory(String targetName, Map<String, String> typeMap) 

Source Link

Document

Construct a parser for CSV lines that encodes the parsed data in vector form.

Usage

From source file:com.ml.ira.algos.LogisticModelParameters.java

License:Apache License

/**
 * Returns a CsvRecordFactory compatible with this logistic model.  The reason that this is tied
 * in here is so that we have access to the list of target categories when it comes time to save
 * the model.  If the input isn't CSV, then calling setTargetCategories before calling saveTo will
 * suffice.// w  ww . j  av  a2s.  c  om
 *
 * @return The CsvRecordFactory.
 */
public CsvRecordFactory getCsvRecordFactory() {
    if (csv == null) {
        csv = new CsvRecordFactory(getTargetVariable(), getTypeMap()).maxTargetValue(getMaxTargetCategories())
                .includeBiasTerm(useBias());
        if (targetCategories != null) {
            csv.defineTargetCategories(targetCategories);
        }
    }
    return csv;
}