public class RawKMeansStrategy extends KDDStrategy
RawKMeansStrategy is a subclass of KDDStrategy that provides an executeStrategy method that runs the KMeans clustering algorithm for a raw data set (matrix). It utilizes the ClusterKDDMatrix to produce a set of Clusters that themselves contain a list of N-dimensional vectors represented as KDDMatrices. It is itself an IAnalysisAsset that creates a file of cluster points and returns a URI of that file to be used by clients.
It expects an IDataProvider (can be set of IDataProviders) that provide a feature list that contains three features: "Data", which corresponds to the list of IData elements of the matrix to be clustered, in row major order; "Number of Rows", which corresponds to an IData element detailing the number of rows in the matrix; and "Number of Columns", which corresponds to an IData element detailing the number of columns in the matrix to be clustered.
Constructor and Description |
---|
RawKMeansStrategy(java.util.ArrayList<IDataProvider> data)
The constructor, takes an array of IDataProviders.
|
RawKMeansStrategy(ClusterKDDMatrix matrix)
Constructor used for injecting a specific ClusterKDDMatrix.
|
Modifier and Type | Method and Description |
---|---|
boolean |
executeStrategy()
This method allows subclasses to implement a unique clustering or anomaly
detection algorithm and produce a KDDAnalysisAsset for clients to display
and manipulate.
|
int |
getNumberOfClusters()
Return the number of clusters after the kmeans clustering algorithm is
executed.
|
java.util.ArrayList<Entry> |
getPropertiesAsEntryList()
This operation returns the asset's properties as a list of Entry objects.
|
getName, getProperties, getProperty, getType, getURI, resetProperties, setProperty
public RawKMeansStrategy(java.util.ArrayList<IDataProvider> data) throws java.lang.IllegalArgumentException
The constructor, takes an array of IDataProviders. By convention, the first IDataProvider of that array will be the loaded data to be analyzed. Any other IDataProviders will be reference or extra data.
data
- java.lang.IllegalArgumentException
public RawKMeansStrategy(ClusterKDDMatrix matrix)
Constructor used for injecting a specific ClusterKDDMatrix. Primarily used for unit testing.
matrix
- public java.util.ArrayList<Entry> getPropertiesAsEntryList()
This operation returns the asset's properties as a list of Entry objects.
getPropertiesAsEntryList
in interface IAnalysisAsset
getPropertiesAsEntryList
in class KDDStrategy
public int getNumberOfClusters()
Return the number of clusters after the kmeans clustering algorithm is executed.
public boolean executeStrategy()
KDDStrategy
This method allows subclasses to implement a unique clustering or anomaly detection algorithm and produce a KDDAnalysisAsset for clients to display and manipulate.
executeStrategy
in class KDDStrategy