@ALDAOperator(genericExecutionMode=NONE,
level=STANDARD)
public class KMeans
extends MTBOperator
| Modifier and Type | Field and Description |
|---|---|
private MTBTableModel |
clusterLabels
List of assigned cluster indices, starting with 1.
|
private int |
clusterNum
Number of clusters to be used.
|
private MTBTableModel |
data
Data to be clustered.
|
private int[] |
excludeList
Exclude list with indices of attributes to ignore.
|
| Constructor and Description |
|---|
KMeans()
Default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
private void |
doClustering(weka.core.Instances dataSet)
Does the actual clustering.
|
MTBTableModel |
getDataLabels()
Get assigned labels.
|
protected void |
operate()
This method does the actual work.
|
private weka.core.Instances |
prepareWekaData()
Converts the given data set into Weka instances.
|
void |
setClusterNum(int num)
Specify number of clusters.
|
void |
setExcludeList(int[] ids)
Specify attributes to be excluded.
|
void |
setInputData(MTBTableModel inputData)
Specify input data.
|
readResolveaddOperatorExecutionProgressEventListener, addParameter, addParameter, addParameterUnconditioned, fieldContained, fireOperatorExecutionProgressEvent, getALDPortHashAccessKey, getConstructionMode, getDocumentation, getHidingMode, getInactiveParameterNames, getInInoutNames, getInInoutNames, getInNames, getInOutNames, getMissingRequiredInputs, getName, getNumParameters, getOutInoutNames, getOutNames, getParameter, getParameterDescriptor, getParameterDescriptorUnconditioned, getParameterNames, getParameterUnconditioned, getSupplementalNames, getVerbose, getVersion, handleOperatorExecutionProgressEvent, hasInOutParameters, hasParameter, isAnnotatedParameter, isConfigured, print, print, print, printInterface, printInterface, readHistory, reinitializeParameterDescriptors, removeOperatorExecutionProgressEventListener, removeParameter, runOp, runOp, runOp, setConstructionMode, setConstructionMode, setConstructionMode, setHidingMode, setName, setParameter, setParameterUnconditioned, setVerbose, toStringVerbose, unconfiguredItems, validate, validateCustom, validateGeneric, writeHistory, writeHistory, writeHistory@Parameter(label="Data set",
required=true,
dataIOOrder=0,
direction=IN,
mode=STANDARD,
description="Data set to be clustered.")
private MTBTableModel data
Each line of the table represents one vector, headers encode attributes.
@Parameter(label="Number of clusters",
required=true,
dataIOOrder=1,
direction=IN,
mode=STANDARD,
description="Number of clusters.")
private int clusterNum
@Parameter(label="Exclude list",
required=true,
dataIOOrder=2,
direction=IN,
mode=ADVANCED,
description="Indices to exclude.")
private int[] excludeList
Note that the attribute indices start with 1.
@Parameter(label="Cluster labels",
dataIOOrder=0,
direction=OUT,
description="Labels.")
private transient MTBTableModel clusterLabels
public KMeans()
throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDOperatorExceptionprotected void operate()
throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
operate in class de.unihalle.informatik.Alida.operator.ALDOperatorde.unihalle.informatik.Alida.exceptions.ALDOperatorExceptionprivate weka.core.Instances prepareWekaData()
private void doClustering(weka.core.Instances dataSet)
throws Exception
dataSet - Data set to be clustered.Exceptionpublic void setInputData(MTBTableModel inputData)
inputData - Data to be clustered.public void setClusterNum(int num)
num - Number of clusters to be applied.public void setExcludeList(int[] ids)
ids - List of IDs to be ignored.public MTBTableModel getDataLabels()
Copyright © 2010–2020 Martin Luther University Halle-Wittenberg, Institute of Computer Science, Pattern Recognition and Bioinformatics. All rights reserved.