V
- the type of NumberVector used@Alias(value={"de.lmu.ifi.dbs.elki.parser.NumberVectorLabelParser","de.lmu.ifi.dbs.elki.parser.RealVectorLabelParser"}) public class NumberVectorLabelParser<V extends NumberVector> extends AbstractStreamingParser
Modifier and Type | Class and Description |
---|---|
static class |
NumberVectorLabelParser.Parameterizer<V extends NumberVector>
Parameterization class.
|
BundleStreamSource.Event
Modifier and Type | Field and Description |
---|---|
protected DoubleArray |
attributes
Double array storing the numerical attributes during parsing.
|
protected java.util.List<java.lang.String> |
columnnames
Column names.
|
protected LabelList |
curlbl
Current labels.
|
protected V |
curvec
Current vector.
|
protected NumberVector.Factory<V> |
factory
Vector factory class.
|
protected boolean |
haslabels
Whether or not the data set has labels.
|
private long[] |
labelIndices
Keeps the indices of the attributes to be treated as a string label.
|
(package private) java.util.ArrayList<java.lang.String> |
labels
(Reused) store for labels.
|
private static Logging |
LOG
Logging class.
|
protected int |
maxdim
Dimensionality reported.
|
protected BundleMeta |
meta
Metadata.
|
protected int |
mindim
Dimensionality reported.
|
(package private) BundleStreamSource.Event |
nextevent
Event to report next.
|
(package private) it.unimi.dsi.fastutil.objects.ObjectOpenHashSet<java.lang.String> |
unique
For String unification.
|
(package private) boolean |
warnedPrecision
Emit a double-precision limit warning once.
|
reader, tokenizer
Constructor and Description |
---|
NumberVectorLabelParser(CSVReaderFormat format,
long[] labelIndices,
NumberVector.Factory<V> factory)
Constructor.
|
NumberVectorLabelParser(NumberVector.Factory<V> factory)
Constructor with defaults.
|
NumberVectorLabelParser(java.util.regex.Pattern colSep,
java.lang.String quoteChars,
java.util.regex.Pattern comment,
long[] labelIndices,
NumberVector.Factory<V> factory)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
buildMeta()
Update the meta element.
|
void |
cleanup()
Perform cleanup operations after parsing.
|
protected V |
createVector()
Creates a database object of type V.
|
java.lang.Object |
data(int rnum)
Access a particular object and representation.
|
protected Logging |
getLogger()
Get the logger for this class.
|
BundleMeta |
getMeta()
Get the current meta data.
|
(package private) SimpleTypeInformation<V> |
getTypeInformation(int mindim,
int maxdim)
Get a prototype object for the given dimensionality.
|
void |
initStream(java.io.InputStream in)
Init the streaming parser for the given input stream.
|
protected boolean |
isLabelColumn(int col)
Test if the current column is marked as label column.
|
BundleStreamSource.Event |
nextEvent()
Get the next event
|
protected boolean |
parseLineInternal()
Internal method for parsing a single line.
|
asMultipleObjectsBundle, assignDBID, hasDBIDs, parse
private static final Logging LOG
private long[] labelIndices
protected NumberVector.Factory<V extends NumberVector> factory
protected int mindim
protected int maxdim
protected BundleMeta meta
protected java.util.List<java.lang.String> columnnames
protected boolean haslabels
protected V extends NumberVector curvec
protected LabelList curlbl
protected DoubleArray attributes
final java.util.ArrayList<java.lang.String> labels
it.unimi.dsi.fastutil.objects.ObjectOpenHashSet<java.lang.String> unique
BundleStreamSource.Event nextevent
boolean warnedPrecision
public NumberVectorLabelParser(CSVReaderFormat format, long[] labelIndices, NumberVector.Factory<V> factory)
format
- Input formatlabelIndices
- Column indexes that are not numeric.factory
- Vector factorypublic NumberVectorLabelParser(NumberVector.Factory<V> factory)
factory
- Vector factorypublic NumberVectorLabelParser(java.util.regex.Pattern colSep, java.lang.String quoteChars, java.util.regex.Pattern comment, long[] labelIndices, NumberVector.Factory<V> factory)
colSep
- Column separatorquoteChars
- Quote charactercomment
- Comment patternlabelIndices
- Column indexes that are not numeric.factory
- Vector factoryprotected boolean isLabelColumn(int col)
col
- Column numbertrue
when a label column.public void initStream(java.io.InputStream in)
StreamingParser
initStream
in interface StreamingParser
initStream
in class AbstractStreamingParser
in
- the stream to parse objects frompublic BundleMeta getMeta()
BundleStreamSource
public BundleStreamSource.Event nextEvent()
BundleStreamSource
public void cleanup()
Parser
cleanup
in interface Parser
cleanup
in class AbstractStreamingParser
protected void buildMeta()
public java.lang.Object data(int rnum)
BundleStreamSource
rnum
- Representation numberprotected boolean parseLineInternal()
true
when a valid line was read, false
on a label
row.protected V createVector()
SimpleTypeInformation<V> getTypeInformation(int mindim, int maxdim)
mindim
- Minimum dimensionalitymaxdim
- Maximum dimensionalityprotected Logging getLogger()
AbstractStreamingParser
getLogger
in class AbstractStreamingParser
Copyright © 2019 ELKI Development Team. License information.