|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.ObjectLBJ2.classify.Classifier
LBJ2.learn.Learner
LBJ2.learn.SparseNetworkLearner
public class SparseNetworkLearner
A SparseNetworkLearner uses multiple
LinearThresholdUnits to make a multi-class classification.
Any LinearThresholdUnit may be used, so long as it implements its
clone() method and a public constructor that takes no
arguments.
It is assumed that a single discrete label feature will be produced in association with each example object. A feature taking one of the values observed in that label feature will be produced by the learned classifier.
This algorithm's user-configurable parameters are stored in member
fields of this class. They may be set via either a constructor that names
each parameter explicitly or a constructor that takes an instance of
Parameters as input.
The documentation in each member field in this class indicates the default
value of the associated parameter when using the former type of
constructor. The documentation of the associated member field in the
Parameters class
indicates the default value of the parameter when using the latter type of
constructor.
| Nested Class Summary | |
|---|---|
static class |
SparseNetworkLearner.Parameters
Simply a container for all of SparseNetworkLearner's
configurable parameters. |
| Field Summary | |
|---|---|
protected LinearThresholdUnit |
baseLTU
The underlying algorithm used to learn each class separately as a binary classifier; default defaultBaseLTU. |
static LinearThresholdUnit |
defaultBaseLTU
Default for baseLTU. |
protected java.util.HashMap |
network
A map from labels to the linear threshold unit used to learn each label. |
| Fields inherited from class LBJ2.learn.Learner |
|---|
extractor, labeler |
| Fields inherited from class LBJ2.classify.Classifier |
|---|
containingPackage, name |
| Constructor Summary | |
|---|---|
SparseNetworkLearner()
Instantiates this multi-class learner with the default learning algorithm: defaultBaseLTU. |
|
SparseNetworkLearner(LinearThresholdUnit ltu)
Instantiates this multi-class learner using the specified algorithm to learn each class separately as a binary classifier. |
|
SparseNetworkLearner(SparseNetworkLearner.Parameters p)
Initializing constructor. |
|
SparseNetworkLearner(java.lang.String n)
Instantiates this multi-class learner with the default learning algorithm: defaultBaseLTU. |
|
SparseNetworkLearner(java.lang.String n,
LinearThresholdUnit ltu)
Instantiates this multi-class learner using the specified algorithm to learn each class separately as a binary classifier. |
|
SparseNetworkLearner(java.lang.String n,
SparseNetworkLearner.Parameters p)
Initializing constructor. |
|
| Method Summary | |
|---|---|
FeatureVector |
classify(java.lang.Object example)
This implementation uses a winner-take-all comparison of the outputs from the individual linear threshold units' score methods. |
java.lang.Object |
clone()
Returns a deep clone of this learning algorithm. |
void |
doneLearning()
Simply calls doneLearning() on every LTU in the network. |
void |
forget()
Clears the network. |
void |
learn(java.lang.Object example)
Each example is treated as a positive example for the linear threshold unit associated with the label's value that is active for the example and as a negative example for all other linear threshold units in the network. |
ScoreSet |
scores(java.lang.Object example)
Produces a set of scores indicating the degree to which each possible discrete classification value is associated with the given example object. |
ScoreSet |
scores(java.lang.Object example,
java.util.Collection candidates)
Returns scores for only those labels in the given collection. |
void |
setExtractor(Classifier e)
Sets the extractor. |
void |
setLabeler(Classifier l)
Sets the labeler. |
void |
setLTU(LinearThresholdUnit ltu)
Sets the baseLTU variable. |
java.lang.String |
valueOf(java.lang.Object example,
java.util.Collection candidates)
Using this method, the winner-take-all competition is narrowed to involve only those labels contained in the specified list. |
void |
write(java.io.PrintStream out)
Writes the algorithm's internal representation as text. |
| 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, getOutputType, realValue, realValueArray, test, toString, valueIndexOf |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final LinearThresholdUnit defaultBaseLTU
baseLTU.
protected LinearThresholdUnit baseLTU
defaultBaseLTU.
protected java.util.HashMap network
| Constructor Detail |
|---|
public SparseNetworkLearner()
defaultBaseLTU.
public SparseNetworkLearner(LinearThresholdUnit ltu)
ltu - The linear threshold unit used to learn binary classifiers.public SparseNetworkLearner(SparseNetworkLearner.Parameters p)
SparseNetworkLearner.Parameters object.
p - The settings of all parameters.public SparseNetworkLearner(java.lang.String n)
defaultBaseLTU.
n - The name of the classifier.
public SparseNetworkLearner(java.lang.String n,
LinearThresholdUnit ltu)
n - The name of the classifier.ltu - The linear threshold unit used to learn binary classifiers.
public SparseNetworkLearner(java.lang.String n,
SparseNetworkLearner.Parameters p)
SparseNetworkLearner.Parameters object.
n - The name of the classifier.p - The settings of all parameters.| Method Detail |
|---|
public void setLTU(LinearThresholdUnit ltu)
baseLTU variable. This method will not
have any effect on the LTUs that already exist in the network. However,
new LTUs created after this method is executed will be of the same type
as the object specified.
ltu - The new LTU.public void setLabeler(Classifier l)
setLabeler in class Learnerl - A labeling classifier.public void setExtractor(Classifier e)
setExtractor in class Learnere - A feature extracting classifier.public void learn(java.lang.Object example)
learn in class Learnerexample - The example object.public void doneLearning()
doneLearning() on every LTU in the network.
doneLearning in class Learnerpublic void forget()
forget in class Learnerpublic ScoreSet scores(java.lang.Object example)
LinearThresholdUnit.scores(Object).
scores in class Learnerexample - The example object.
LinearThresholdUnit.scores(Object)public FeatureVector classify(java.lang.Object example)
classify in class Classifierexample - The example object.
public java.lang.String valueOf(java.lang.Object example,
java.util.Collection candidates)
Strings.
example - The example object.candidates - A list of the only labels the example may take.
null if the network did not contain any
of the specified labels.
public ScoreSet scores(java.lang.Object example,
java.util.Collection candidates)
LinearThresholdUnit associated with a given label
from the collection, that label's score in the returned ScoreSet
will be set to Double.NEGATIVE_INFINITY.
example - The example object.candidates - A list of the only labels the example may take.
candidates.public void write(java.io.PrintStream out)
write in class Learnerout - The output stream.public java.lang.Object clone()
clone in class Classifier
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||