|
||||||||||
| 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.LinearThresholdUnit
LBJ2.learn.SparsePerceptron
public class SparsePerceptron
Simple sparse Perceptron implementation. It is assumed that
Learner.labeler is a single discrete classifier that produces the
same feature for every example object and that the values that feature may
take are available through the
Classifier.allowableValues() method. The second
value returned from Classifier.allowableValues() is
treated as "positive", and it is assumed there are exactly 2 allowable
values. Assertions will produce error messages if these assumptions do
not hold.
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 |
SparsePerceptron.Parameters
Simply a container for all of SparsePerceptron's configurable
parameters. |
| Field Summary | |
|---|---|
static double |
defaultLearningRate
Default value for learningRate. |
protected double |
learningRate
The rate at which weights are updated; default defaultLearningRate. |
| Fields inherited from class LBJ2.learn.LinearThresholdUnit |
|---|
allowableValues, bias, defaultInitialWeight, defaultThickness, defaultThreshold, defaultWeightVector, initialWeight, negativeThickness, positiveThickness, threshold, weightVector |
| Fields inherited from class LBJ2.learn.Learner |
|---|
extractor, labeler |
| Fields inherited from class LBJ2.classify.Classifier |
|---|
containingPackage, name |
| Constructor Summary | |
|---|---|
SparsePerceptron()
The learning rate and threshold take default values, while the name of the classifier gets the empty string. |
|
SparsePerceptron(double r)
Sets the learning rate to the specified value, and the threshold takes the default, while the name of the classifier gets the empty string. |
|
SparsePerceptron(double r,
double t)
Sets the learning rate and threshold to the specified values, while the name of the classifier gets the empty string. |
|
SparsePerceptron(double r,
double t,
double pt)
Use this constructor to fit a thick separator, where both the positive and negative sides of the hyperplane will be given the specified thickness, while the name of the classifier gets the empty string. |
|
SparsePerceptron(double r,
double t,
double pt,
double nt)
Use this constructor to fit a thick separator, where the positive and negative sides of the hyperplane will be given the specified separate thicknesses, while the name of the classifier gets the empty string. |
|
SparsePerceptron(double r,
double t,
double pt,
double nt,
SparseWeightVector v)
Use this constructor to specify an alternative subclass of SparseWeightVector, while the name of the classifier gets the
empty string. |
|
SparsePerceptron(SparsePerceptron.Parameters p)
Initializing constructor. |
|
SparsePerceptron(java.lang.String n)
The learning rate and threshold take default values. |
|
SparsePerceptron(java.lang.String n,
double r)
Sets the learning rate to the specified value, and the threshold takes the default. |
|
SparsePerceptron(java.lang.String n,
double r,
double t)
Sets the learning rate and threshold to the specified values. |
|
SparsePerceptron(java.lang.String n,
double r,
double t,
double pt)
Use this constructor to fit a thick separator, where both the positive and negative sides of the hyperplane will be given the specified thickness. |
|
SparsePerceptron(java.lang.String n,
double r,
double t,
double pt,
double nt)
Use this constructor to fit a thick separator, where the positive and negative sides of the hyperplane will be given the specified separate thicknesses. |
|
SparsePerceptron(java.lang.String n,
double r,
double t,
double pt,
double nt,
SparseWeightVector v)
Use this constructor to specify an alternative subclass of SparseWeightVector. |
|
SparsePerceptron(java.lang.String n,
SparsePerceptron.Parameters p)
Initializing constructor. |
|
| Method Summary | |
|---|---|
java.lang.Object |
clone()
Returns a deep clone of this learning algorithm. |
void |
demote(java.lang.Object example)
Scales the feature vector produced by the extractor by the learning rate and subtracts it from the weight vector. |
double |
getLearningRate()
Returns the current value of the learningRate variable. |
void |
promote(java.lang.Object example)
Scales the feature vector produced by the extractor by the learning rate and adds it to the weight vector. |
void |
setLearningRate(double r)
Sets the learningRate member variable to the specified
value. |
void |
write(java.io.PrintStream out)
Writes the algorithm's internal representation as text. |
| Methods inherited from class LBJ2.learn.LinearThresholdUnit |
|---|
allowableValues, classify, forget, getInitialWeight, getNegativeThickness, getPositiveThickness, getThreshold, learn, score, scores, setInitialWeight, setLabeler, setNegativeThickness, setPositiveThickness, setThickness, setThreshold |
| Methods inherited from class LBJ2.learn.Learner |
|---|
doneLearning, getExtractor, getLabeler, learn, save, setExtractor |
| Methods inherited from class LBJ2.classify.Classifier |
|---|
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 double defaultLearningRate
learningRate.
protected double learningRate
defaultLearningRate.
| Constructor Detail |
|---|
public SparsePerceptron()
public SparsePerceptron(double r)
r - The desired learning rate value.
public SparsePerceptron(double r,
double t)
r - The desired learning rate value.t - The desired threshold value.
public SparsePerceptron(double r,
double t,
double pt)
r - The desired learning rate value.t - The desired threshold value.pt - The desired thickness.
public SparsePerceptron(double r,
double t,
double pt,
double nt)
r - The desired learning rate value.t - The desired threshold value.pt - The desired positive thickness.nt - The desired negative thickness.
public SparsePerceptron(double r,
double t,
double pt,
double nt,
SparseWeightVector v)
SparseWeightVector, while the name of the classifier gets the
empty string.
r - The desired learning rate value.t - The desired threshold value.pt - The desired positive thickness.nt - The desired negative thickness.v - An empty sparse weight vector.public SparsePerceptron(SparsePerceptron.Parameters p)
SparsePerceptron.Parameters object.
p - The settings of all parameters.public SparsePerceptron(java.lang.String n)
n - The name of the classifier.
public SparsePerceptron(java.lang.String n,
double r)
n - The name of the classifier.r - The desired learning rate value.
public SparsePerceptron(java.lang.String n,
double r,
double t)
n - The name of the classifier.r - The desired learning rate value.t - The desired threshold value.
public SparsePerceptron(java.lang.String n,
double r,
double t,
double pt)
n - The name of the classifier.r - The desired learning rate value.t - The desired threshold value.pt - The desired thickness.
public SparsePerceptron(java.lang.String n,
double r,
double t,
double pt,
double nt)
n - The name of the classifier.r - The desired learning rate value.t - The desired threshold value.pt - The desired positive thickness.nt - The desired negative thickness.
public SparsePerceptron(java.lang.String n,
double r,
double t,
double pt,
double nt,
SparseWeightVector v)
SparseWeightVector.
n - The name of the classifier.r - The desired learning rate value.t - The desired threshold value.pt - The desired positive thickness.nt - The desired negative thickness.v - An empty sparse weight vector.
public SparsePerceptron(java.lang.String n,
SparsePerceptron.Parameters p)
SparsePerceptron.Parameters object.
n - The name of the classifier.p - The settings of all parameters.| Method Detail |
|---|
public double getLearningRate()
learningRate variable.
learningRate variable.public void setLearningRate(double r)
learningRate member variable to the specified
value.
r - The new value for learningRate.public void promote(java.lang.Object example)
promote in class LinearThresholdUnitexample - The example object.public void demote(java.lang.Object example)
demote in class LinearThresholdUnitexample - The example object.public void write(java.io.PrintStream out)
learningRate, LinearThresholdUnit.initialWeight,
LinearThresholdUnit.threshold,
LinearThresholdUnit.positiveThickness,
LinearThresholdUnit.negativeThickness, and finally
LinearThresholdUnit.bias.
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 | |||||||||