|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.mahout.classifier.sgd.CsvRecordFactory
public class CsvRecordFactory
Converts csv data lines to vectors. Use of this class proceeds in a few steps.
Constructor Summary | |
---|---|
CsvRecordFactory(java.lang.String targetName,
java.util.Map<java.lang.String,java.lang.String> typeMap)
Construct a parser for CSV lines that encodes the parsed data in vector form. |
Method Summary | |
---|---|
void |
defineTargetCategories(java.util.List<java.lang.String> values)
Defines the values and thus the encoding of values of the target variables. |
void |
firstLine(java.lang.String line)
Processes the first line of a file (which should contain the variable names). |
java.lang.Iterable<java.lang.String> |
getPredictors()
Returns a list of the names of the predictor variables. |
java.util.List<java.lang.String> |
getTargetCategories()
|
java.util.Map<java.lang.String,java.util.Set<java.lang.Integer>> |
getTraceDictionary()
|
CsvRecordFactory |
includeBiasTerm(boolean useBias)
|
CsvRecordFactory |
maxTargetValue(int max)
Defines the number of target variable categories, but allows this parser to pick encodings for them as they appear. |
int |
processLine(java.lang.String line,
Vector featureVector)
Decodes a single line of csv data and records the target and predictor variables in a record. |
boolean |
usesFirstLineAsSchema()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CsvRecordFactory(java.lang.String targetName, java.util.Map<java.lang.String,java.lang.String> typeMap)
targetName
- The name of the target variable.typeMap
- A map describing the types of the predictor variables.Method Detail |
---|
public void defineTargetCategories(java.util.List<java.lang.String> values)
defineTargetCategories
in interface RecordFactory
values
- The values the target variable can have.public CsvRecordFactory maxTargetValue(int max)
maxTargetValue
in interface RecordFactory
max
- The number of categories that will be excpeted. Once this many have been
seen, all others will get the encoding max-1.public boolean usesFirstLineAsSchema()
usesFirstLineAsSchema
in interface RecordFactory
public void firstLine(java.lang.String line)
firstLine
in interface RecordFactory
line
- Header line for the file.public int processLine(java.lang.String line, Vector featureVector)
processLine
in interface RecordFactory
line
- The raw data.featureVector
- Where to fill in the features. Should be zeroed before calling
processLine.
public java.lang.Iterable<java.lang.String> getPredictors()
getPredictors
in interface RecordFactory
public java.util.Map<java.lang.String,java.util.Set<java.lang.Integer>> getTraceDictionary()
getTraceDictionary
in interface RecordFactory
public CsvRecordFactory includeBiasTerm(boolean useBias)
includeBiasTerm
in interface RecordFactory
public java.util.List<java.lang.String> getTargetCategories()
getTargetCategories
in interface RecordFactory
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |