|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.lmu.ifi.dbs.elki.algorithm.AbstractAlgorithm<Clustering<Model>> de.lmu.ifi.dbs.elki.algorithm.clustering.trivial.ByLabelClustering
@Title(value="Clustering by label") @Description(value="Cluster points by a (pre-assigned!) label. For comparing results with a reference clustering.") public class ByLabelClustering
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_ID
needs to be set.
TODO: handling of data sets with no labels?
Nested Class Summary | |
---|---|
static class |
ByLabelClustering.Parameterizer
Parameterization class. |
Field Summary | |
---|---|
private static Logging |
logger
The logger for this class. |
private boolean |
multiple
Holds the value of MULTIPLE_ID . |
static OptionID |
MULTIPLE_ID
Flag to indicate that multiple cluster assignment is possible. |
static OptionID |
NOISE_ID
Flag to indicate that multiple cluster assignment is possible. |
private Pattern |
noisepattern
Holds the value of NOISE_ID . |
Constructor Summary | |
---|---|
ByLabelClustering()
Constructor without parameters |
|
ByLabelClustering(boolean multiple,
Pattern noisepattern)
Constructor. |
Method Summary | |
---|---|
private void |
assign(HashMap<String,ModifiableDBIDs> labelMap,
String label,
DBID id)
Assigns the specified id to the labelMap according to its label |
TypeInformation[] |
getInputTypeRestriction()
Get the input type restriction used for negotiating the data query. |
protected Logging |
getLogger()
Get the (STATIC) logger for this class. |
private HashMap<String,ModifiableDBIDs> |
multipleAssignment(Relation<?> data)
Assigns the objects of the database to multiple clusters according to their labels. |
Clustering<Model> |
run(Database database)
Runs the algorithm. |
Clustering<Model> |
run(Relation<?> relation)
Run the actual clustering algorithm. |
private HashMap<String,ModifiableDBIDs> |
singleAssignment(Relation<?> data)
Assigns the objects of the database to single clusters according to their labels. |
Methods inherited from class de.lmu.ifi.dbs.elki.algorithm.AbstractAlgorithm |
---|
makeParameterDistanceFunction |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final Logging logger
public static final OptionID MULTIPLE_ID
public static final OptionID NOISE_ID
private boolean multiple
MULTIPLE_ID
.
private Pattern noisepattern
NOISE_ID
.
Constructor Detail |
---|
public ByLabelClustering(boolean multiple, Pattern noisepattern)
multiple
- Allow multiple cluster assignmentsnoisepattern
- Noise patternpublic ByLabelClustering()
Method Detail |
---|
public Clustering<Model> run(Database database)
Algorithm
run
in interface Algorithm
run
in interface ClusteringAlgorithm<Clustering<Model>>
run
in class AbstractAlgorithm<Clustering<Model>>
database
- the database to run the algorithm on
public Clustering<Model> run(Relation<?> relation)
relation
- The data input we useprivate HashMap<String,ModifiableDBIDs> singleAssignment(Relation<?> data)
data
- the database storing the objects
private HashMap<String,ModifiableDBIDs> multipleAssignment(Relation<?> data)
data
- the database storing the objects
private void assign(HashMap<String,ModifiableDBIDs> labelMap, String label, DBID id)
labelMap
- the mapping of label to idslabel
- the label of the object to be assignedid
- the id of the object to be assignedpublic TypeInformation[] getInputTypeRestriction()
AbstractAlgorithm
getInputTypeRestriction
in interface Algorithm
getInputTypeRestriction
in class AbstractAlgorithm<Clustering<Model>>
protected Logging getLogger()
AbstractAlgorithm
getLogger
in class AbstractAlgorithm<Clustering<Model>>
|
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |