public class KMeansMapTask
extends java.lang.Object
implements weka.core.OptionHandler, java.io.Serializable
Constructor and Description |
---|
KMeansMapTask() |
Modifier and Type | Method and Description |
---|---|
weka.core.Instance |
applyFilters(weka.core.Instance original)
Apply the filters (if any) for this map task to the supplied instance
|
weka.core.Instances |
applyFilters(weka.core.Instances toApplyTo)
Apply the filters (if any) setup for this map task to the supplied
instances
|
static java.util.List<weka.core.Instances> |
assignStartPointsFromList(int numRuns,
int numClusters,
java.util.List<weka.core.Instance> candidates,
weka.core.Instances headerNoSummary)
Utility method to choose start points for a number of runs of k-means given
a list of randomly selected instance objects.
|
double |
distance(weka.core.Instance one,
weka.core.Instance two)
Computes the distance between the two supplied instances
|
java.lang.String |
dontReplaceMissingValuesTipText()
Returns the tip text for this property.
|
java.lang.String |
filtersToUseTipText()
The tool tip text for this property.
|
java.util.List<weka.core.Instances> |
getCentroidStats()
Get the summary stats for each centroid
|
boolean |
getConverged()
Get whether the run of k-means that this map tasks is associated with has
converged
|
weka.core.NormalizableDistance |
getDistanceFunction()
Get the distance function in use
|
boolean |
getDontReplaceMissingValues()
Gets whether missing values are to be replaced.
|
weka.filters.Filter[] |
getFiltersToUse()
Get the user-specified filters to use with the k-means clusterer.
|
java.lang.String[] |
getOptions() |
weka.filters.Filter |
getPreprocessingFilters()
Gets the full set of preprocessing filters
|
weka.core.Instances |
getTransformedHeader()
Get the header of the data after it has been through any pre-processing
filters specified by the user
|
weka.core.Instances |
init(weka.core.Instances headerWithSummary)
Initilizes the map task.
|
java.util.Enumeration<weka.core.Option> |
listOptions() |
void |
processInstance(weka.core.Instance toProcess)
Processes a training instance.
|
void |
setCentroids(weka.core.Instances centers)
Set the cluster centroids to use for this iteration.
|
void |
setConverged(boolean converged)
Set whether the run of k-means that this map is associated with has
converged or not
|
void |
setDontReplaceMissingValues(boolean r)
Sets whether missing values are to be replaced.
|
void |
setDummyDistancePrimingData(weka.core.Instances priming)
Set the dummy priming data (two-instance dataset that contains global
min/max for numeric attributes) for the distance function to use when
normalizing numeric attributes.
|
void |
setFiltersToUse(weka.filters.Filter[] toUse)
Set the user-specified filters to use with the k-means clusterer.
|
void |
setOptions(java.lang.String[] options) |
public weka.core.Instances init(weka.core.Instances headerWithSummary) throws DistributedWekaException
headerWithSummary
- header of the incoming instances with summary
attributes includedDistributedWekaException
public void setDummyDistancePrimingData(weka.core.Instances priming) throws DistributedWekaException
priming
- the dummy priming data to use in the distance functionDistributedWekaException
public void processInstance(weka.core.Instance toProcess) throws DistributedWekaException
toProcess
- the instance to processDistributedWekaException
- if a problem occurspublic double distance(weka.core.Instance one, weka.core.Instance two) throws DistributedWekaException
one
- the first instancetwo
- the second instanceDistributedWekaException
- if a problem occurspublic java.util.List<weka.core.Instances> getCentroidStats()
public java.lang.String dontReplaceMissingValuesTipText()
public void setDontReplaceMissingValues(boolean r)
r
- true if missing values are to be replacedpublic boolean getDontReplaceMissingValues()
public weka.core.NormalizableDistance getDistanceFunction()
public void setCentroids(weka.core.Instances centers)
centers
- the centroids to usepublic weka.core.Instances applyFilters(weka.core.Instances toApplyTo) throws java.lang.Exception
toApplyTo
- the instances to filerjava.lang.Exception
- if a problem occurspublic weka.core.Instance applyFilters(weka.core.Instance original) throws java.lang.Exception
original
- the instance in the original spacejava.lang.Exception
- if a problem occurspublic weka.filters.Filter getPreprocessingFilters()
public void setConverged(boolean converged)
converged
- true if the run has convergedpublic boolean getConverged()
public weka.core.Instances getTransformedHeader()
public weka.filters.Filter[] getFiltersToUse()
public void setFiltersToUse(weka.filters.Filter[] toUse)
toUse
- the user-specified filters to use with k-meanspublic java.lang.String filtersToUseTipText()
public java.util.Enumeration<weka.core.Option> listOptions()
listOptions
in interface weka.core.OptionHandler
public void setOptions(java.lang.String[] options) throws java.lang.Exception
setOptions
in interface weka.core.OptionHandler
java.lang.Exception
public java.lang.String[] getOptions()
getOptions
in interface weka.core.OptionHandler
public static java.util.List<weka.core.Instances> assignStartPointsFromList(int numRuns, int numClusters, java.util.List<weka.core.Instance> candidates, weka.core.Instances headerNoSummary) throws DistributedWekaException
numRuns
- the numeber of runs of k-meansnumClusters
- the number of clusters/start points for each runcandidates
- the list of total candidates to choose randomly fromheaderNoSummary
- the header of the dataDistributedWekaException
- if a problem occurs