V
- the type of NumberVector usedpublic abstract class NumberVectorLabelParser<V extends NumberVector<?,?>> extends AbstractParser implements LinebasedParser, Parser
Provides a parser for parsing one point per line, attributes separated by whitespace.
Several labels may be given per point. A label must not be parseable as double. Lines starting with "#" will be ignored.
An index can be specified to identify an entry to be treated as class label. This index counts all entries (numeric and labels as well) starting with 0.
Modifier and Type | Class and Description |
---|---|
static class |
NumberVectorLabelParser.Parameterizer<V extends NumberVector<?,?>>
Parameterization class.
|
Modifier and Type | Field and Description |
---|---|
static OptionID |
LABEL_INDICES_ID
A comma separated list of the indices of labels (may be numeric), counting
whitespace separated entries in a line starting with 0.
|
protected BitSet |
labelIndices
Keeps the indices of the attributes to be treated as a string label.
|
ATTRIBUTE_CONCATENATION, COLUMN_SEPARATOR_ID, COMMENT, NUMBER_PATTERN, QUOTE_CHAR, QUOTE_ID, quoteChar, WHITESPACE_PATTERN
Constructor and Description |
---|
NumberVectorLabelParser(Pattern colSep,
char quoteChar,
BitSet labelIndices)
Constructor
|
Modifier and Type | Method and Description |
---|---|
protected abstract V |
createDBObject(List<Double> attributes)
Creates a database object of type V.
|
protected abstract VectorFieldTypeInformation<V> |
getTypeInformation(int dimensionality)
Get a prototype object for the given dimensionality.
|
MultipleObjectsBundle |
parse(InputStream in)
Returns a list of the objects parsed from the specified input stream.
|
SingleObjectBundle |
parseLine(String line)
Parse a single line into a database object
|
protected Pair<V,LabelList> |
parseLineInternal(String line)
Internal method for parsing a single line.
|
getLogger, tokenize, toString
public static final OptionID LABEL_INDICES_ID
Key: -parser.labelIndices
protected BitSet labelIndices
public MultipleObjectsBundle parse(InputStream in)
Parser
public SingleObjectBundle parseLine(String line)
LinebasedParser
parseLine
in interface LinebasedParser
line
- single lineprotected Pair<V,LabelList> parseLineInternal(String line)
line
- Line to processprotected abstract V createDBObject(List<Double> attributes)
Creates a database object of type V.
attributes
- the attributes of the vector to create.protected abstract VectorFieldTypeInformation<V> getTypeInformation(int dimensionality)
dimensionality
- Dimensionality