Package adams.ml.model.clustering
Class WekaClusteringModel
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.ml.model.clustering.WekaClusteringModel
-
- All Implemented Interfaces:
adams.core.logging.LoggingSupporter
,adams.core.SizeOfHandler
,adams.ml.model.clustering.ClusteringModel
,adams.ml.model.Model
,Serializable
public class WekaClusteringModel extends adams.core.logging.LoggingObject implements adams.ml.model.clustering.ClusteringModel
Clustering model for Weka classifiers.- Version:
- $Revision$
- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected adams.ml.data.DatasetInfo
m_DatasetInfo
the dataset info.protected weka.core.Instances
m_InstancesHeader
the instances used.protected weka.clusterers.Clusterer
m_Model
the underlying model.
-
Constructor Summary
Constructors Constructor Description WekaClusteringModel(weka.clusterers.Clusterer model, adams.ml.data.Dataset data, weka.core.Instances inst)
Initializes the model.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
cluster(adams.data.spreadsheet.Row row)
Returns the cluster for the given row.double[]
distribution(adams.data.spreadsheet.Row row)
Returns the cluster distribution for the given row.adams.ml.data.DatasetInfo
getDatasetInfo()
Returns information about the dataset used for building the model.weka.core.Instances
getInstancesHeader()
Returns the Instances header used for building the model.String
getModelDescription()
Gets a short string description of the model.String
isCompatible(adams.ml.data.Dataset data)
Checks whether the dataset is compatible with the model.
-
-
-
Method Detail
-
cluster
public int cluster(adams.data.spreadsheet.Row row) throws Exception
Returns the cluster for the given row.- Specified by:
cluster
in interfaceadams.ml.model.clustering.ClusteringModel
- Parameters:
row
- the row to make predictions for- Returns:
- the prediction
- Throws:
Exception
- if prediction fails
-
distribution
public double[] distribution(adams.data.spreadsheet.Row row) throws Exception
Returns the cluster distribution for the given row.- Specified by:
distribution
in interfaceadams.ml.model.clustering.ClusteringModel
- Parameters:
row
- the row to generate the cluster distribution for- Returns:
- the cluster distribution
- Throws:
Exception
- if prediction fails
-
getDatasetInfo
public adams.ml.data.DatasetInfo getDatasetInfo()
Returns information about the dataset used for building the model.- Specified by:
getDatasetInfo
in interfaceadams.ml.model.Model
- Returns:
- the information
-
getInstancesHeader
public weka.core.Instances getInstancesHeader()
Returns the Instances header used for building the model.- Returns:
- the header
-
getModelDescription
public String getModelDescription()
Gets a short string description of the model.- Specified by:
getModelDescription
in interfaceadams.ml.model.Model
- Returns:
- the description, null if none available
-
isCompatible
public String isCompatible(adams.ml.data.Dataset data)
Checks whether the dataset is compatible with the model.- Specified by:
isCompatible
in interfaceadams.ml.model.Model
- Parameters:
data
- the dataset to check- Returns:
- null if compatible, otherwise error message why not
-
-