com.rapidminer.operator.learner.weka
Class WekaClassifier

java.lang.Object
  extended by com.rapidminer.operator.AbstractIOObject
      extended by com.rapidminer.operator.ResultObjectAdapter
          extended by com.rapidminer.operator.AbstractModel
              extended by com.rapidminer.operator.learner.PredictionModel
                  extended by com.rapidminer.operator.learner.weka.WekaClassifier
All Implemented Interfaces:
IOObject, Model, ResultObject, Saveable, Readable, Reportable, LoggingHandler, java.io.Serializable

public class WekaClassifier
extends PredictionModel

A Weka Classifier which can be used to classify Examples. It is learned by the GenericWekaLearner and the GenericWekaMetaLearner.

Author:
Ingo Mierswa
See Also:
Serialized Form

Constructor Summary
WekaClassifier(ExampleSet exampleSet, java.lang.String name, weka.classifiers.Classifier classifier)
           
 
Method Summary
 void applyModelForInstance(weka.core.Instance instance, Example e, Attribute predictedLabelAttribute)
          Classifies ervery weka instance and sets the result as predicted label of the current example.
 boolean equals(java.lang.Object o)
           
 weka.classifiers.Classifier getClassifier()
           
 java.lang.String getName()
          The default implementation returns the result of the super class.
 java.awt.Component getVisualizationComponent(IOContainer container)
          Returns a editor pane that displays the ResultObjectAdapter.toResultString() result encoded as html.
 int hashCode()
           
 boolean isUpdatable()
          Returns true if the Weka classifier is updatable.
 ExampleSet performPrediction(ExampleSet exampleSet, Attribute predictedLabel)
          Subclasses should iterate through the given example set and set the prediction for each example.
 java.lang.String toResultString()
          The default implementation simply returns the result of the method Object.toString().
 java.lang.String toString()
           
 void updateModel(ExampleSet updateExampleSet)
          Updates the model if the classifier is updatable.
 
Methods inherited from class com.rapidminer.operator.learner.PredictionModel
apply, checkCompatibility, copyPredictedLabel, createPredictedLabel, getLabel, removePredictedLabel, removePredictedLabel
 
Methods inherited from class com.rapidminer.operator.AbstractModel
getExtension, getFileDescription, getResultIcon, getTrainingHeader, setParameter
 
Methods inherited from class com.rapidminer.operator.ResultObjectAdapter
addAction, getActions, isSavable, log, logError, logNote, logWarning, save, toHTML
 
Methods inherited from class com.rapidminer.operator.AbstractIOObject
copy, getLog, getSource, initWriting, read, setLoggingHandler, setSource, write
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.rapidminer.operator.ResultObject
getActions
 
Methods inherited from interface com.rapidminer.operator.IOObject
copy, getLog, getSource, setLoggingHandler, setSource, write
 
Methods inherited from interface com.rapidminer.operator.Saveable
isSavable, save
 

Constructor Detail

WekaClassifier

public WekaClassifier(ExampleSet exampleSet,
                      java.lang.String name,
                      weka.classifiers.Classifier classifier)
Method Detail

getClassifier

public weka.classifiers.Classifier getClassifier()

isUpdatable

public boolean isUpdatable()
Returns true if the Weka classifier is updatable.

Specified by:
isUpdatable in interface Model
Overrides:
isUpdatable in class AbstractModel

updateModel

public void updateModel(ExampleSet updateExampleSet)
                 throws OperatorException
Updates the model if the classifier is updatable. Otherwise, an UnsupportedOperationException is thrown.

Specified by:
updateModel in interface Model
Overrides:
updateModel in class AbstractModel
Throws:
OperatorException

performPrediction

public ExampleSet performPrediction(ExampleSet exampleSet,
                                    Attribute predictedLabel)
                             throws OperatorException
Description copied from class: PredictionModel
Subclasses should iterate through the given example set and set the prediction for each example. The given predicted label attribute was already be added to the example set and should be used to set the predicted values.

Specified by:
performPrediction in class PredictionModel
Throws:
OperatorException

applyModelForInstance

public void applyModelForInstance(weka.core.Instance instance,
                                  Example e,
                                  Attribute predictedLabelAttribute)
Classifies ervery weka instance and sets the result as predicted label of the current example.


getName

public java.lang.String getName()
Description copied from class: AbstractModel
The default implementation returns the result of the super class. If the string ends with model, the substring "model" is removed.

Specified by:
getName in interface ResultObject
Overrides:
getName in class AbstractModel

toString

public java.lang.String toString()
Specified by:
toString in interface Readable
Overrides:
toString in class PredictionModel

toResultString

public java.lang.String toResultString()
Description copied from class: ResultObjectAdapter
The default implementation simply returns the result of the method Object.toString().

Specified by:
toResultString in interface ResultObject
Overrides:
toResultString in class ResultObjectAdapter

getVisualizationComponent

public java.awt.Component getVisualizationComponent(IOContainer container)
Description copied from class: ResultObjectAdapter
Returns a editor pane that displays the ResultObjectAdapter.toResultString() result encoded as html. Please note that the returned pane is already enclosed by a scroll pane. If you overwrite this method you should again ensure that the returned component is scrollable. The given container is totally ignored.

Specified by:
getVisualizationComponent in interface ResultObject
Overrides:
getVisualizationComponent in class ResultObjectAdapter

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object


Copyright © 2001-2009 by Rapid-I