|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectmulan.classifier.MultiLabelLearnerBase
public abstract class MultiLabelLearnerBase
Common root base class for all multi-label learner types.
Provides default implementation of MultiLabelLearner interface.
| Field Summary | |
|---|---|
protected int[] |
featureIndices
An array containing the indexes of the feature attributes within the Instances object of the training data in increasing order. |
protected int[] |
labelIndices
An array containing the indexes of the label attributes within the Instances object of the training data in increasing order. |
protected int |
numLabels
The number of labels the learner can handle. |
| Constructor Summary | |
|---|---|
MultiLabelLearnerBase()
|
|
| Method Summary | |
|---|---|
void |
build(MultiLabelInstances trainingSet)
Builds the learner model from specified MultiLabelInstances data. |
protected abstract void |
buildInternal(MultiLabelInstances trainingSet)
Learner specific implementation of building the model from MultiLabelInstances
training data set. |
protected void |
debug(String msg)
Writes the debug message string to the console output if debug for the learner is enabled. |
boolean |
getDebug()
Get whether debugging is turned on. |
abstract TechnicalInformation |
getTechnicalInformation()
Returns an instance of a TechnicalInformation object, containing detailed information about the technical background of this class, e.g., paper reference or book this class is based on. |
abstract String |
globalInfo()
Returns a string describing the multi-label learner. |
protected boolean |
isModelInitialized()
Gets whether learner's model is initialized by build(MultiLabelInstances). |
boolean |
isUpdatable()
Returns value indicating if learner is updatable, so if learner is able to perform on-line learning. |
MultiLabelLearner |
makeCopy()
Creates a deep copy of the given learner using serialization. |
MultiLabelOutput |
makePrediction(Instance instance)
Returns the prediction of the learner for a given input Instance. |
protected abstract MultiLabelOutput |
makePredictionInternal(Instance instance)
Learner specific implementation for predicting on specified data based on trained model. |
void |
setDebug(boolean debug)
Set debugging mode. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected int numLabels
protected int[] labelIndices
Instances object of the training data in increasing order. The same
order will be followed in the arrays of predictions given by each learner
in the MultiLabelOutput object.
protected int[] featureIndices
Instances object of the training data in increasing order.
| Constructor Detail |
|---|
public MultiLabelLearnerBase()
| Method Detail |
|---|
public boolean isUpdatable()
MultiLabelLearnerMultiLabelLearner.build(MultiLabelInstances) method.false is returned, each call of the
MultiLabelLearner.build(MultiLabelInstances) will initialize the learner from
the scratch, removing any potential knowledge built by previously entered training data.
When true is returned, then on the first call of the
MultiLabelLearner.build(MultiLabelInstances) the learner is initialized
with the passed training data. All other calls contribute to the existing learner's
model with new data.
isUpdatable in interface MultiLabelLearnertrue if learner is updatable (on-line), false otherwise.
public final void build(MultiLabelInstances trainingSet)
throws Exception
MultiLabelLearnerMultiLabelInstances data.
Sequential calls to this method either re-build the learners model with new data
(off-line learner) or contribute to the existing model with new data (on-line learner).
The behavior is determined by the outcome of MultiLabelLearner.isUpdatable() method.
build in interface MultiLabelLearnertrainingSet - set of training data, upon which the learner model should be built
Exception - if learner model was not created successfully
InvalidDataException - if specified instances data is invalid or not supported by the learnerMultiLabelLearner.isUpdatable()
protected abstract void buildInternal(MultiLabelInstances trainingSet)
throws Exception
MultiLabelInstances
training data set. This method is called from build(MultiLabelInstances) method,
where behavior common across all learners is applied.
trainingSet - the training data set
Exception - if learner model was not created successfullyprotected boolean isModelInitialized()
build(MultiLabelInstances).
This is used to check if makePrediction(weka.core.Instance) can be processed.
public final MultiLabelOutput makePrediction(Instance instance)
throws Exception,
InvalidDataException,
ModelInitializationException
MultiLabelLearnerInstance.
makePrediction in interface MultiLabelLearnerinstance - the input given to the learner in the form of Instance
MultiLabelOutput.
Exception - if an error occurs while making the prediction.
InvalidDataException - if specified instance data is invalid and can not be processed by the learner
ModelInitializationException - if method is called before MultiLabelLearner.build(MultiLabelInstances)
protected abstract MultiLabelOutput makePredictionInternal(Instance instance)
throws Exception,
InvalidDataException
makePrediction(weka.core.Instance) which guards for model
initialization and apply common handling/behavior.
instance - the data instance to predict on
Exception - if an error occurs while making the prediction.
InvalidDataException - if specified instance data is invalid and can not be processed by the learnerpublic void setDebug(boolean debug)
setDebug in interface MultiLabelLearnerdebug - true if debug output should be printedpublic boolean getDebug()
true if debugging output is onprotected void debug(String msg)
msg - the debug message
public MultiLabelLearner makeCopy()
throws Exception
MultiLabelLearner
makeCopy in interface MultiLabelLearnerException - if an error occurs while making copy of the learner.public abstract TechnicalInformation getTechnicalInformation()
getTechnicalInformation in interface TechnicalInformationHandlerpublic abstract String globalInfo()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||