LBJ2.learn
Class MultiLabelLearner

java.lang.Object
  extended by LBJ2.classify.Classifier
      extended by LBJ2.learn.Learner
          extended by LBJ2.learn.SparseNetworkLearner
              extended by LBJ2.learn.MultiLabelLearner
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class MultiLabelLearner
extends SparseNetworkLearner

A simple implementation of a learner that learns from examples with multiple labels and is capable of predicting multiple labels on new examples. A separate LinearThresholdUnit is learned independently to predict whether each label is appropriate for a given example. Any LinearThresholdUnit may be used, so long as it implements its clone() method and a public constructor that takes no arguments. During testing, the classify(Object) method returns a separate feature for each LinearThresholdUnit whose score on the example object exceeds the threshold.

See Also:
Serialized Form

Nested Class Summary
static class MultiLabelLearner.Parameters
          Simply a container for all of MultiLabelLearner's configurable parameters.
 
Field Summary
 
Fields inherited from class LBJ2.learn.SparseNetworkLearner
baseLTU, defaultBaseLTU, network
 
Fields inherited from class LBJ2.learn.Learner
extractor, labeler
 
Fields inherited from class LBJ2.classify.Classifier
containingPackage, name
 
Constructor Summary
MultiLabelLearner()
          Instantiates this multi-label learner with the default learning algorithm: SparsePerceptron.
MultiLabelLearner(LinearThresholdUnit ltu)
          Instantiates this multi-label learner using the specified algorithm to learn each class separately as a binary classifier.
MultiLabelLearner(MultiLabelLearner.Parameters p)
          Initializing constructor.
MultiLabelLearner(java.lang.String n)
          Instantiates this multi-label learner with the default learning algorithm: SparsePerceptron.
MultiLabelLearner(java.lang.String n, LinearThresholdUnit ltu)
          Instantiates this multi-label learner using the specified algorithm to learn each class separately as a binary classifier.
MultiLabelLearner(java.lang.String n, MultiLabelLearner.Parameters p)
          Initializing constructor.
 
Method Summary
 FeatureVector classify(java.lang.Object example)
          Returns a separate feature for each LinearThresholdUnit whose score on the example object exceeds the threshold.
 java.lang.String getOutputType()
          This learner's output type is "discrete%".
 void learn(java.lang.Object example)
          Each example is treated as a positive example for each linear threshold unit associated with a feature produced by the labeler, and as a negative example for all other linear threshold units in the network.
 
Methods inherited from class LBJ2.learn.SparseNetworkLearner
clone, doneLearning, forget, scores, scores, setExtractor, setLabeler, setLTU, valueOf, write
 
Methods inherited from class LBJ2.learn.Learner
getExtractor, getLabeler, learn, save
 
Methods inherited from class LBJ2.classify.Classifier
allowableValues, binaryRead, binaryRead, binaryRead, binaryRead, binaryWrite, binaryWrite, classify, discreteValue, discreteValueArray, getCompositeChildren, getInputType, realValue, realValueArray, test, toString, valueIndexOf
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MultiLabelLearner

public MultiLabelLearner()
Instantiates this multi-label learner with the default learning algorithm: SparsePerceptron.


MultiLabelLearner

public MultiLabelLearner(LinearThresholdUnit ltu)
Instantiates this multi-label learner using the specified algorithm to learn each class separately as a binary classifier. This constructor will normally only be called by the compiler.

Parameters:
ltu - The linear threshold unit used to learn binary classifiers.

MultiLabelLearner

public MultiLabelLearner(MultiLabelLearner.Parameters p)
Initializing constructor. Sets all member variables to their associated settings in the MultiLabelLearner.Parameters object.

Parameters:
p - The settings of all parameters.

MultiLabelLearner

public MultiLabelLearner(java.lang.String n)
Instantiates this multi-label learner with the default learning algorithm: SparsePerceptron.

Parameters:
n - The name of the classifier.

MultiLabelLearner

public MultiLabelLearner(java.lang.String n,
                         LinearThresholdUnit ltu)
Instantiates this multi-label learner using the specified algorithm to learn each class separately as a binary classifier.

Parameters:
n - The name of the classifier.
ltu - The linear threshold unit used to learn binary classifiers.

MultiLabelLearner

public MultiLabelLearner(java.lang.String n,
                         MultiLabelLearner.Parameters p)
Initializing constructor. Sets all member variables to their associated settings in the MultiLabelLearner.Parameters object.

Parameters:
n - The name of the classifier.
p - The settings of all parameters.
Method Detail

getOutputType

public java.lang.String getOutputType()
This learner's output type is "discrete%".

Overrides:
getOutputType in class Classifier
Returns:
A string representation of the output feature type of this classifier.

learn

public void learn(java.lang.Object example)
Each example is treated as a positive example for each linear threshold unit associated with a feature produced by the labeler, and as a negative example for all other linear threshold units in the network.

Overrides:
learn in class SparseNetworkLearner
Parameters:
example - The example object.

classify

public FeatureVector classify(java.lang.Object example)
Returns a separate feature for each LinearThresholdUnit whose score on the example object exceeds the threshold.

Overrides:
classify in class SparseNetworkLearner
Parameters:
example - The example object.
Returns:
A vector containing the features described above.