Package adams.ml.model.regression
Class WekaRegressionModel
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.ml.model.regression.WekaRegressionModel
-
- All Implemented Interfaces:
LoggingSupporter,SizeOfHandler,Model,RegressionModel,Serializable
public class WekaRegressionModel extends LoggingObject implements RegressionModel
Regression 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 DatasetInfom_DatasetInfothe dataset info.protected weka.core.Instancesm_InstancesHeaderthe instances used.protected weka.classifiers.Classifierm_Modelthe underlying model.-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description WekaRegressionModel(weka.classifiers.Classifier model, Dataset data, weka.core.Instances inst)Initializes the model.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description doubleclassify(Row row)Returns the regression for the given row.DatasetInfogetDatasetInfo()Returns information about the dataset used for building the model.weka.core.InstancesgetInstancesHeader()Returns the Instances header used for building the model.StringgetModelDescription()Gets a short string description of the model.StringisCompatible(Dataset data)Checks whether the dataset is compatible with the model.-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
-
-
-
Field Detail
-
m_Model
protected weka.classifiers.Classifier m_Model
the underlying model.
-
m_DatasetInfo
protected DatasetInfo m_DatasetInfo
the dataset info.
-
m_InstancesHeader
protected weka.core.Instances m_InstancesHeader
the instances used.
-
-
Constructor Detail
-
WekaRegressionModel
public WekaRegressionModel(weka.classifiers.Classifier model, Dataset data, weka.core.Instances inst)Initializes the model.- Parameters:
model- the built Weka classifierdata- the training datainst- the Weka training data
-
-
Method Detail
-
classify
public double classify(Row row) throws Exception
Returns the regression for the given row.- Specified by:
classifyin interfaceRegressionModel- Parameters:
row- the row to make predictions for- Returns:
- the prediction
- Throws:
Exception- if prediction fails
-
getDatasetInfo
public DatasetInfo getDatasetInfo()
Returns information about the dataset used for building the model.- Specified by:
getDatasetInfoin interfaceModel- 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:
getModelDescriptionin interfaceModel- Returns:
- the description, null if none available
-
isCompatible
public String isCompatible(Dataset data)
Checks whether the dataset is compatible with the model.- Specified by:
isCompatiblein interfaceModel- Parameters:
data- the dataset to check- Returns:
- null if compatible, otherwise error message why not
-
-