V
- Vector type@Title(value="libSVM Format Parser") public class LibSVMFormatParser<V extends SparseNumberVector> extends SparseNumberVectorLabelParser<V>
The format of libSVM is roughly specified in the README given:
<label> <index1>:<value1> <index2>:<value2> ...i.e. a mandatory integer class label in the beginning followed by a classic sparse vector representation of the data. indexes are integers, starting at 1 (Note that ELKI uses 0-based indexing, so we will map these to index-1) to not always have a constant-0 dimension 0.
The libSVM FAQ states that you can also put comments into the file, separated
by a hash: #, but they must not contain colons and are not
officially supported.
ELKI will simply stop parsing a line when encountering a #.
Modifier and Type | Class and Description |
---|---|
static class |
LibSVMFormatParser.Parameterizer<V extends SparseNumberVector>
Parameterization class.
|
BundleStreamSource.Event
Modifier and Type | Field and Description |
---|---|
static java.util.regex.Pattern |
COMMENT_PATTERN
Comment pattern.
|
private static Logging |
LOG
Class logger.
|
static java.util.regex.Pattern |
WHITESPACE_PATTERN
LibSVM uses whitespace and colons for separation.
|
labels, sparsefactory, values
attributes, columnnames, curlbl, curvec, factory, haslabels, maxdim, meta, mindim, nextevent, unique, warnedPrecision
reader, tokenizer
Constructor and Description |
---|
LibSVMFormatParser(SparseNumberVector.Factory<V> factory)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected Logging |
getLogger()
Get the logger for this class.
|
protected boolean |
parseLineInternal()
Internal method for parsing a single line.
|
getTypeInformation
buildMeta, cleanup, createVector, data, getMeta, initStream, isLabelColumn, nextEvent
asMultipleObjectsBundle, assignDBID, hasDBIDs, parse
private static final Logging LOG
public static final java.util.regex.Pattern WHITESPACE_PATTERN
public static final java.util.regex.Pattern COMMENT_PATTERN
public LibSVMFormatParser(SparseNumberVector.Factory<V> factory)
factory
- Vector factoryprotected boolean parseLineInternal()
NumberVectorLabelParser
parseLineInternal
in class SparseNumberVectorLabelParser<V extends SparseNumberVector>
true
when a valid line was read, false
on a label
row.protected Logging getLogger()
AbstractStreamingParser
getLogger
in class SparseNumberVectorLabelParser<V extends SparseNumberVector>
Copyright © 2019 ELKI Development Team. License information.