Package elki.datasource.parser
Class ClusteringVectorParser
- java.lang.Object
-
- elki.datasource.parser.AbstractStreamingParser
-
- elki.datasource.parser.ClusteringVectorParser
-
- All Implemented Interfaces:
BundleStreamSource
,Parser
,StreamingParser
public class ClusteringVectorParser extends AbstractStreamingParser
Parser for simple clustering results in vector form, as written byClusteringVectorDumper
.This allows reading the output of multiple clustering runs, and analyze the results using ELKI algorithm.
The input format is very simple, each line containing a sequence of cluster assignments in integer form, and an optional label:
0 0 1 1 0 First 0 0 0 1 2 Second
represents two clusterings for 5 objects. The first clustering has two clusters, the second contains three clusters.TODO: this parser currently is quite hacky, and could use a cleanup.
TODO: support noise, via negative cluster numbers?
- Since:
- 0.7.0
- Author:
- Erich Schubert
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ClusteringVectorParser.Par
Parameterization class.-
Nested classes/interfaces inherited from interface elki.datasource.bundle.BundleStreamSource
BundleStreamSource.Event
-
-
Field Summary
Fields Modifier and Type Field Description (package private) it.unimi.dsi.fastutil.ints.IntArrayList
buf1
Buffers, will be reused.(package private) Clustering<Model>
curclu
Current clustering.(package private) LabelList
curlbl
Current labels.(package private) boolean
haslbl
Flag if labels are present.(package private) java.util.ArrayList<java.lang.String>
lbl
Buffer for labels.private static Logging
LOG
Class logger.protected BundleMeta
meta
Metadata.(package private) BundleStreamSource.Event
nextevent
Event to report next.(package private) int
numterms
Number of different terms observed.(package private) DBIDRange
range
Range of the DBID values.-
Fields inherited from class elki.datasource.parser.AbstractStreamingParser
reader, tokenizer
-
-
Constructor Summary
Constructors Constructor Description ClusteringVectorParser(CSVReaderFormat format)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.void
initStream(java.io.InputStream in)
Init the streaming parser for the given input stream.BundleStreamSource.Event
nextEvent()
Get the next event-
Methods inherited from class elki.datasource.parser.AbstractStreamingParser
asMultipleObjectsBundle, assignDBID, cleanup, hasDBIDs, parse
-
-
-
-
Field Detail
-
LOG
private static final Logging LOG
Class logger.
-
numterms
int numterms
Number of different terms observed.
-
meta
protected BundleMeta meta
Metadata.
-
nextevent
BundleStreamSource.Event nextevent
Event to report next.
-
curclu
Clustering<Model> curclu
Current clustering.
-
curlbl
LabelList curlbl
Current labels.
-
buf1
it.unimi.dsi.fastutil.ints.IntArrayList buf1
Buffers, will be reused.
-
range
DBIDRange range
Range of the DBID values.
-
lbl
java.util.ArrayList<java.lang.String> lbl
Buffer for labels.
-
haslbl
boolean haslbl
Flag if labels are present.
-
-
Constructor Detail
-
ClusteringVectorParser
public ClusteringVectorParser(CSVReaderFormat format)
Constructor.- Parameters:
format
- Input format
-
-
Method Detail
-
initStream
public void initStream(java.io.InputStream in)
Description copied from interface:StreamingParser
Init the streaming parser for the given input stream.- Specified by:
initStream
in interfaceStreamingParser
- Overrides:
initStream
in classAbstractStreamingParser
- Parameters:
in
- the stream to parse objects from
-
nextEvent
public BundleStreamSource.Event nextEvent()
Description copied from interface:BundleStreamSource
Get the next event- Returns:
- Event type
-
data
public java.lang.Object data(int rnum)
Description copied from interface:BundleStreamSource
Access a particular object and representation.- Parameters:
rnum
- Representation number- Returns:
- Contained data
-
getMeta
public BundleMeta getMeta()
Description copied from interface:BundleStreamSource
Get the current meta data.- Returns:
- Metadata
-
getLogger
protected Logging getLogger()
Description copied from class:AbstractStreamingParser
Get the logger for this class.- Specified by:
getLogger
in classAbstractStreamingParser
- Returns:
- Logger.
-
-