
V - vector type@Title(value="Sparse Vector Label Parser") @Description(value="Parser for the following line format:\nA single line provides a single point. Entries are separated by whitespace. The values will be parsed as floats (resulting in a set of SparseFloatVectors). A line is expected in the following format: The first entry of each line is the number of attributes with coordinate value not zero. Subsequent entries are of the form (index, value), where index is the number of the corresponding dimension, and value is the value of the corresponding attribute.Any pair of two subsequent substrings not containing whitespace is tried to be read as int and float. If this fails for the first of the pair (interpreted ans index), it will be appended to a label. (Thus, any label must not be parseable as Integer.) If the float component is not parseable, an exception will be thrown. Empty lines and lines beginning with \"#\" will be ignored.") public class SparseNumberVectorLabelParser<V extends SparseNumberVector<?>> extends NumberVectorLabelParser<V>
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.
 A line is expected in the following format: The first entry of each line is
 the number of attributes with coordinate value not zero. Subsequent entries
 are of the form index value  each, where index is the number of
 the corresponding dimension, and value is the value of the corresponding
 attribute. A complet line then could look like this:
 
 
3 7 12.34 8 56.78 11 1.234 objectlabelwhere
3 indicates there are three attributes set,
 7,8,11 are the attributes indexes and there is a non-numerical
 object label.
 
 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  | 
SparseNumberVectorLabelParser.Parameterizer<V extends SparseNumberVector<?>>
Parameterization class. 
 | 
BundleStreamSource.Event| Modifier and Type | Field and Description | 
|---|---|
private static Logging | 
LOG
Class logger. 
 | 
private int | 
maxdim
Holds the dimensionality of the parsed data which is the maximum occurring
 index of any attribute. 
 | 
private SparseNumberVector.Factory<V,?> | 
sparsefactory
Same as  
NumberVectorLabelParser.factory, but subtype. | 
columnnames, curlbl, curvec, dimensionality, DIMENSIONALITY_UNKNOWN, DIMENSIONALITY_VARIABLE, factory, LABEL_INDICES_ID, labelcolumns, labelIndices, lineNumber, meta, nextevent, VECTOR_TYPE_IDATTRIBUTE_CONCATENATION, comment, COMMENT_PATTERN, DEFAULT_SEPARATOR, NUMBER_PATTERN, QUOTE_CHAR, quoteChar| Constructor and Description | 
|---|
SparseNumberVectorLabelParser(Pattern colSep,
                             char quoteChar,
                             Pattern comment,
                             BitSet labelIndices,
                             SparseNumberVector.Factory<V,?> factory)
Constructor. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
protected Logging | 
getLogger()
Get the logger for this class. 
 | 
protected SimpleTypeInformation<V> | 
getTypeInformation(int dimensionality)
Get a prototype object for the given dimensionality. 
 | 
protected void | 
parseLineInternal(String line)
Internal method for parsing a single line. 
 | 
buildMeta, createDBObject, data, getMeta, initStream, nextEventparsetokenize, toStringprivate static final Logging LOG
private int maxdim
private SparseNumberVector.Factory<V extends SparseNumberVector<?>,?> sparsefactory
NumberVectorLabelParser.factory, but subtype.public SparseNumberVectorLabelParser(Pattern colSep, char quoteChar, Pattern comment, BitSet labelIndices, SparseNumberVector.Factory<V,?> factory)
colSep - Column separatorquoteChar - Quotation charactercomment - Comment patternlabelIndices - Indices to use as labelsfactory - Vector factoryprotected void parseLineInternal(String line)
NumberVectorLabelParserparseLineInternal in class NumberVectorLabelParser<V extends SparseNumberVector<?>>line - Line to processprotected SimpleTypeInformation<V> getTypeInformation(int dimensionality)
NumberVectorLabelParsergetTypeInformation in class NumberVectorLabelParser<V extends SparseNumberVector<?>>dimensionality - Dimensionalityprotected Logging getLogger()
AbstractParsergetLogger in class NumberVectorLabelParser<V extends SparseNumberVector<?>>