public abstract class BaseClusterer extends java.lang.Object implements Options, Printable, java.io.Serializable, java.lang.Cloneable, Commandable
Implemented Commands:
train $<dataset> - Train a clustering algorithm
<output> = get <num> $<input> - Get a certain cluster from a dataset
selector $<selector> - Define an attribute selector to use before clustering
split $<dataset> <filename> [<format>] - Split dataset into several clusters, save them
Implemented Print Commands:
selector - Print out attributes used to generate cluster, if an BaseAttributeSelector was provided stats [<command>] - Print out statistics about clustering
Implementation guide:
In order to create a new instance of this class, one must implement:
train_protected(magpie.data.Dataset) - Train the clustererlabel_protected(magpie.data.Dataset) - Label entries based on their predicted clusterNClusters_protected() - Return the number of possible clustersOptions.setOptions(java.util.List<java.lang.Object>) - Define options for this subset given optionsclone() - Make sure no clones overwrite data in original| Constructor and Description |
|---|
BaseClusterer() |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
about()
Prints a simple status message about this object
|
BaseClusterer |
clone() |
Dataset |
getCluster(Dataset From,
int number)
Retrieve a specific cluster from a dataset.
|
protected abstract java.util.List<java.lang.String> |
getClustererDetails(boolean htmlFormat)
Get any user-specified options of this clusterer.
|
boolean |
isTrained() |
protected abstract int[] |
label_protected(Dataset Data)
Actual implementation of
label(magpie.data.Dataset). |
int[] |
label(Dataset Data)
Mark the most likely cluster for each entry
|
protected abstract int |
NClusters_protected()
Actual implementation of
NClusters(). |
int |
NClusters()
How many different clusters data may be partitioned into
|
Dataset[] |
partitionDataset(Dataset Data)
Separate the Dataset based on predicted classes.
|
java.lang.String |
printCommand(java.util.List<java.lang.String> Command)
Handles more complicated printing commands.
|
java.lang.String |
printDescription(boolean htmlFormat)
Print full name of object, and a simple description of the options.
|
java.lang.Object |
runCommand(java.util.List<java.lang.Object> Command)
Process some command described by a list of Objects.
|
void |
setAttributeSelector(BaseAttributeSelector AttributeSelector)
Define an attribute selector to be used before clustering
|
protected abstract void |
train_protected(Dataset Data)
Perform the actual training.
|
void |
train(Dataset TrainingData)
Train the clusterer
|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitprintUsage, setOptionspublic BaseClusterer clone()
clone in class java.lang.Objectpublic void setAttributeSelector(BaseAttributeSelector AttributeSelector)
AttributeSelector - Instantiated Attribute Selectorpublic boolean isTrained()
public void train(Dataset TrainingData)
TrainingData - Training dataprotected abstract void train_protected(Dataset Data)
Data - Dataset to use for trainingpublic int[] label(Dataset Data)
Data - Dataset to labelprotected abstract int[] label_protected(Dataset Data)
label(magpie.data.Dataset).Data - Dataset to be labeledpublic int NClusters()
protected abstract int NClusters_protected()
NClusters().public Dataset[] partitionDataset(Dataset Data)
Data - Dataset to be partitioned (does not get altered)spublic Dataset getCluster(Dataset From, int number)
From - Dataset to be clusterednumber - Cluster number to extractpublic java.lang.String about()
Printablepublic java.lang.String printDescription(boolean htmlFormat)
PrintableExample: For a model training a separate WekaRegression for intermetallics
magpie.models.regression.SplitRegression
printDescription in interface PrintablehtmlFormat - Whether format for output to an HTML page
(e.g., <div> to create indentation) or for printing to screen.#printModel()protected abstract java.util.List<java.lang.String> getClustererDetails(boolean htmlFormat)
public java.lang.String printCommand(java.util.List<java.lang.String> Command)
throws java.lang.Exception
PrintableprintCommand in interface PrintableCommand - Command specifying what to printjava.lang.Exception - If command not understoodpublic java.lang.Object runCommand(java.util.List<java.lang.Object> Command)
throws java.lang.Exception
CommandablerunCommand in interface CommandableCommand - Command as a list of objectsjava.lang.Exception - If something goes wrong