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 classClusteringVectorParser.ParParameterization 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.IntArrayListbuf1Buffers, will be reused.(package private) Clustering<Model>curcluCurrent clustering.(package private) LabelListcurlblCurrent labels.(package private) booleanhaslblFlag if labels are present.(package private) java.util.ArrayList<java.lang.String>lblBuffer for labels.private static LoggingLOGClass logger.protected BundleMetametaMetadata.(package private) BundleStreamSource.EventnexteventEvent to report next.(package private) intnumtermsNumber of different terms observed.(package private) DBIDRangerangeRange 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.Objectdata(int rnum)Access a particular object and representation.protected LogginggetLogger()Get the logger for this class.BundleMetagetMeta()Get the current meta data.voidinitStream(java.io.InputStream in)Init the streaming parser for the given input stream.BundleStreamSource.EventnextEvent()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:StreamingParserInit the streaming parser for the given input stream.- Specified by:
initStreamin interfaceStreamingParser- Overrides:
initStreamin classAbstractStreamingParser- Parameters:
in- the stream to parse objects from
-
nextEvent
public BundleStreamSource.Event nextEvent()
Description copied from interface:BundleStreamSourceGet the next event- Returns:
- Event type
-
data
public java.lang.Object data(int rnum)
Description copied from interface:BundleStreamSourceAccess a particular object and representation.- Parameters:
rnum- Representation number- Returns:
- Contained data
-
getMeta
public BundleMeta getMeta()
Description copied from interface:BundleStreamSourceGet the current meta data.- Returns:
- Metadata
-
getLogger
protected Logging getLogger()
Description copied from class:AbstractStreamingParserGet the logger for this class.- Specified by:
getLoggerin classAbstractStreamingParser- Returns:
- Logger.
-
-