|
||||||||||
| 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.MuxLearner
public class MuxLearner
A MuxLearner uses one of many Learners indexed
by the first feature in an example to produce a classification. During
training, the features produced by the first child classifier of this
classifier's composite generator feature extractor are taken to determine
which Learners will learn from the training object. For any
given example, there must be one Feature produced by the
labeler for each Feature produced by the first child
classifier. If this classifier's feature extractor is not a composite
generator, the first feature it produces is the only one taken.
It is assumed that the Learner being multiplexed expects
a single label feature on each training example, and that the feature(s)
used to do the multiplexing are DiscreteFeature(s).
Furthermore, if this classifier's feature extractor is a composite
generator, it must produce the same number of features as this
classifier's labeler, and they must correspond to each other in the order
produced.
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 |
MuxLearner.Parameters
Simply a container for all of MuxLearner's configurable
parameters. |
| Field Summary | |
|---|---|
protected Learner |
baseLearner
Instances of this learning algorithm will be multiplexed; default null. |
static Learner |
defaultBaseLearner
Default for baseLearner. |
static java.lang.String |
defaultDefaultPrediction
Default for defaultPrediction. |
protected Feature |
defaultFeature
A feature whose value is defaultPrediction. |
protected java.lang.String |
defaultPrediction
This string is returned during testing when the multiplexed Learner doesn't exist; default
defaultDefaultPrediction. |
protected OVector |
network
A map from feature values to learners. |
| Fields inherited from class LBJ2.learn.Learner |
|---|
encoding, extractor, labeler, labelLexicon, lcFilePath, lexFilePath, lexicon, predictions, readLexiconOnDemand |
| Fields inherited from class LBJ2.classify.Classifier |
|---|
containingPackage, name |
| Constructor Summary | |
|---|---|
MuxLearner()
For the LBJ compiler; not for use by the LBJ user. |
|
MuxLearner(Learner base)
Instantiates this multiplexed learner using the specified base learning algorithm. |
|
MuxLearner(Learner base,
java.lang.String d)
Instantiates this multiplexed learner using the specified base learning algorithm. |
|
MuxLearner(MuxLearner.Parameters p)
Initializing constructor. |
|
MuxLearner(java.lang.String n)
For the LBJ compiler; not for use by the LBJ user. |
|
MuxLearner(java.lang.String n,
Learner base)
Instantiates this multiplexed learner using the specified base learning algorithm. |
|
MuxLearner(java.lang.String n,
Learner base,
java.lang.String d)
Instantiates this multiplexed learner using the specified base learning algorithm. |
|
MuxLearner(java.lang.String n,
MuxLearner.Parameters p)
Initializing constructor. |
|
| Method Summary | |
|---|---|
FeatureVector |
classify(int[] exampleFeatures,
double[] exampleValues)
This method performs the multiplexing and returns the output of the selected Learner. |
java.lang.Object |
clone()
Returns a deep clone of this learning algorithm. |
java.lang.String |
discreteValue(int[] exampleFeatures,
double[] exampleValues)
Returns the value of the discrete feature that would be returned by this classifier. |
Feature |
featureValue(int[] f,
double[] v)
Returns the classification of the given example as a single feature instead of a FeatureVector. |
void |
forget()
Clears the network. |
Learner.Parameters |
getParameters()
Retrieves the parameters that are set in this learner. |
void |
learn(int[] exampleFeatures,
double[] exampleValues,
int[] exampleLabels,
double[] labelValues)
The training example is multiplexed to the appropriate Learner(s). |
void |
read(ExceptionlessInputStream in)
Reads the binary representation of a learner with this object's run-time type, overwriting any and all learned or manually specified parameters as well as the label lexicon but without modifying the feature lexicon. |
double |
realValue(int[] f,
double[] v)
Returns the value of the real feature that would be returned by this classifier. |
ScoreSet |
scores(int[] exampleFeatures,
double[] exampleValues)
Produces a set of scores indicating the degree to which each possible discrete classification value is associated with the given example object. |
void |
setBase(Learner base)
Sets baseLearner. |
protected void |
setDefaultFeature()
Sets the value of defaultFeature according to the current value
of defaultPrediction. |
void |
setLabeler(Classifier l)
Sets the labeler. |
void |
setLabelLexicon(Lexicon l)
Sets the label lexicon. |
void |
setParameters(MuxLearner.Parameters p)
Sets the values of parameters that control the behavior of this learning algorithm. |
void |
write(ExceptionlessOutputStream out)
Writes the learned function's internal representation in binary form. |
void |
write(java.io.PrintStream out)
Writes the algorithm's internal representation as text. |
| Methods inherited from class LBJ2.classify.Classifier |
|---|
allowableValues, classify, discreteValueArray, getCompositeChildren, getInputType, getOutputType, 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 Learner defaultBaseLearner
baseLearner.
public static final java.lang.String defaultDefaultPrediction
defaultPrediction.
protected Learner baseLearner
null.
protected OVector network
protected java.lang.String defaultPrediction
Learner doesn't exist; default
defaultDefaultPrediction.
protected Feature defaultFeature
defaultPrediction.
| Constructor Detail |
|---|
public MuxLearner()
public MuxLearner(Learner base)
base - Instances of this learner will be multiplexed.
public MuxLearner(Learner base,
java.lang.String d)
base - Instances of this learner will be multiplexed.d - This prediction will be returned during testing when the
multiplexed Learner does not exist.public MuxLearner(MuxLearner.Parameters p)
MuxLearner.Parameters object.
p - The settings of all parameters.public MuxLearner(java.lang.String n)
public MuxLearner(java.lang.String n,
Learner base)
n - The name of the classifier.base - Instances of this learner will be multiplexed.
public MuxLearner(java.lang.String n,
Learner base,
java.lang.String d)
n - The name of the classifier.base - Instances of this learner will be multiplexed.d - This prediction will be returned during testing when the
multiplexed Learner does not exist.
public MuxLearner(java.lang.String n,
MuxLearner.Parameters p)
MuxLearner.Parameters object.
n - The name of the classifier.p - The settings of all parameters.| Method Detail |
|---|
public void setParameters(MuxLearner.Parameters p)
p - The parameters.protected void setDefaultFeature()
defaultFeature according to the current value
of defaultPrediction.
public Learner.Parameters getParameters()
getParameters in class Learnerpublic void setBase(Learner base)
baseLearner. This method will not have any effect
on the learners that already exist in the network. However, new
learners created after this method is executed will be of the same type
as the object specified.
base - The new base learning algorithm.public void setLabeler(Classifier l)
setLabeler in class Learnerl - A labeling classifier.public void setLabelLexicon(Lexicon l)
setLabelLexicon in class Learnerl - A feature lexicon.
public void learn(int[] exampleFeatures,
double[] exampleValues,
int[] exampleLabels,
double[] labelValues)
Learner(s).
learn in class LearnerexampleFeatures - The example's array of feature indices.exampleValues - The example's array of feature values.exampleLabels - The example's label(s).labelValues - The labels' values.public void forget()
forget in class Learner
public ScoreSet scores(int[] exampleFeatures,
double[] exampleValues)
Learner's scores(Object) method.
scores in class LearnerexampleFeatures - The example's array of feature indices.exampleValues - The example's array of feature values.
Learner.scores(Object)
public java.lang.String discreteValue(int[] exampleFeatures,
double[] exampleValues)
discreteValue in class LearnerexampleFeatures - The example's array of feature indices.exampleValues - The example's array of feature values.
public double realValue(int[] f,
double[] v)
realValue in class Learnerf - The features array.v - The values array.
public Feature featureValue(int[] f,
double[] v)
FeatureVector.
featureValue in class Learnerf - The features array.v - The values array.
public FeatureVector classify(int[] exampleFeatures,
double[] exampleValues)
Learner.
classify in class LearnerexampleFeatures - The example's array of feature indices.exampleValues - The example's array of feature values.
Learner.public void write(java.io.PrintStream out)
write in class Learnerout - The output stream.public void write(ExceptionlessOutputStream out)
write in class Learnerout - The output stream.public void read(ExceptionlessInputStream in)
read in class Learnerin - The input stream.public java.lang.Object clone()
clone in class Learner
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||