|
|
|||||||||||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.lmu.ifi.dbs.elki.logging.AbstractLoggable
de.lmu.ifi.dbs.elki.algorithm.AbstractAlgorithm<O,Clustering<Model>>
de.lmu.ifi.dbs.elki.algorithm.clustering.ByLabelClustering<O>
O
- Object type@Title(value="Clustering by label") @Description(value="Cluster points by a (pre-assigned!) label. For comparing results with a reference clustering.") public class ByLabelClustering<O extends DatabaseObject>
Pseudo clustering using labels.
This "algorithm" puts elements into the same cluster when they agree in their
labels. I.e. it just uses a predefined clustering, and is mostly useful for
testing and evaluation (e.g. comparing the result of a real algorithm to a
reference result / golden standard).
If an assignment of an object to multiple clusters is desired, the labels of
the object indicating the clusters need to be separated by blanks and the
flag MULTIPLE_FLAG
needs to be set.
TODO: handling of data sets with no labels?
TODO: Noise handling (e.g. allow the user to specify a noise label pattern?)
Field Summary | |
---|---|
private boolean |
multiple
Holds the value of MULTIPLE_FLAG . |
private Flag |
MULTIPLE_FLAG
Flag to indicate that multiple cluster assignment is possible. |
static OptionID |
MULTIPLE_ID
OptionID for MULTIPLE_FLAG |
Fields inherited from class de.lmu.ifi.dbs.elki.logging.AbstractLoggable |
---|
debug, logger |
Constructor Summary | |
---|---|
ByLabelClustering()
Constructor without parameters |
|
ByLabelClustering(Parameterization config)
Constructor, adhering to Parameterizable |
Method Summary | |
---|---|
private void |
assign(HashMap<String,Collection<Integer>> labelMap,
String label,
Integer id)
Assigns the specified id to the labelMap according to its label |
private HashMap<String,Collection<Integer>> |
multipleAssignment(Database<O> database)
Assigns the objects of the database to multiple clusters according to their labels. |
protected Clustering<Model> |
runInTime(Database<O> database)
Run the actual clustering algorithm. |
void |
setMultiple(boolean multiple)
Sets the multiple flag to indicate that a multiple cluster assignment is possible. |
private HashMap<String,Collection<Integer>> |
singleAssignment(Database<O> database)
Assigns the objects of the database to single clusters according to their labels. |
Methods inherited from class de.lmu.ifi.dbs.elki.algorithm.AbstractAlgorithm |
---|
isTime, isVerbose, run, setTime, setVerbose |
Methods inherited from class de.lmu.ifi.dbs.elki.logging.AbstractLoggable |
---|
debugFine, debugFiner, debugFinest, exception, progress, verbose, warning |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface de.lmu.ifi.dbs.elki.algorithm.clustering.ClusteringAlgorithm |
---|
run |
Methods inherited from interface de.lmu.ifi.dbs.elki.algorithm.Algorithm |
---|
setTime, setVerbose |
Field Detail |
---|
public static final OptionID MULTIPLE_ID
MULTIPLE_FLAG
private final Flag MULTIPLE_FLAG
Key: -clique.prune
private boolean multiple
MULTIPLE_FLAG
.
Constructor Detail |
---|
public ByLabelClustering(Parameterization config)
Parameterizable
config
- Parameterizationpublic ByLabelClustering()
Method Detail |
---|
protected Clustering<Model> runInTime(Database<O> database) throws IllegalStateException
runInTime
in class AbstractAlgorithm<O extends DatabaseObject,Clustering<Model>>
database
- The database to process
IllegalStateException
- if the algorithm has not been initialized
properly (e.g. the setParameters(String[]) method has been failed
to be called).private HashMap<String,Collection<Integer>> singleAssignment(Database<O> database)
database
- the database storing the objects
private HashMap<String,Collection<Integer>> multipleAssignment(Database<O> database)
database
- the database storing the objects
private void assign(HashMap<String,Collection<Integer>> labelMap, String label, Integer id)
labelMap
- the mapping of label to idslabel
- the label of the object to be assignedid
- the id of the object to be assignedpublic void setMultiple(boolean multiple)
multiple
- the flag to be set
|
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |