|
||||||||||
| 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.StochasticGradientDescent
public class StochasticGradientDescent
Gradient descent is a batch learning algorithm for function approximation in which the learner tries to follow the gradient of the error function to the solution of minimal error. This implementation is a stochastic approximation to gradient descent in which the approximated function is assumed to have linear form.
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 |
StochasticGradientDescent.Parameters
Simply a container for all of StochasticGradientDescent's
configurable parameters. |
| Field Summary | |
|---|---|
protected double |
bias
The bias is stored here rather than as an element of the weight vector. |
static double |
defaultLearningRate
Default value for learningRate. |
static SparseWeightVector |
defaultWeightVector
Default for weightVector. |
protected double |
learningRate
The rate at which weights are updated; default defaultLearningRate. |
protected SparseWeightVector |
weightVector
The hypothesis vector; default defaultWeightVector. |
| Fields inherited from class LBJ2.learn.Learner |
|---|
extractor, labeler |
| Fields inherited from class LBJ2.classify.Classifier |
|---|
containingPackage, name |
| Constructor Summary | |
|---|---|
StochasticGradientDescent()
The learning rate takes the default value, while the name of the classifier gets the empty string. |
|
StochasticGradientDescent(double r)
Sets the learning rate to the specified value, while the name of the classifier gets the empty string. |
|
StochasticGradientDescent(StochasticGradientDescent.Parameters p)
Initializing constructor. |
|
StochasticGradientDescent(java.lang.String n)
The learning rate takes the default value. |
|
StochasticGradientDescent(java.lang.String n,
double r)
Use this constructor to specify an alternative subclass of SparseWeightVector. |
|
StochasticGradientDescent(java.lang.String n,
StochasticGradientDescent.Parameters p)
Initializing constructor. |
|
| Method Summary | |
|---|---|
FeatureVector |
classify(java.lang.Object example)
Simply computes the dot product of the weight vector and the feature vector extracted from the example object. |
java.lang.Object |
clone()
Returns a deep clone of this learning algorithm. |
void |
forget()
Resets the weight vector to all zeros. |
double |
getLearningRate()
Returns the current value of the learningRate variable. |
java.lang.String |
getOutputType()
Returns a string describing the output feature type of this classifier. |
void |
learn(java.lang.Object example)
Trains the learning algorithm given an object as an example. |
ScoreSet |
scores(java.lang.Object example)
Since this algorithm returns a real feature, it does not return scores. |
void |
setLearningRate(double t)
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.Learner |
|---|
doneLearning, getExtractor, getLabeler, learn, save, setExtractor, setLabeler |
| 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 |
| Field Detail |
|---|
public static final double defaultLearningRate
learningRate.
public static final SparseWeightVector defaultWeightVector
weightVector.
protected SparseWeightVector weightVector
defaultWeightVector.
protected double bias
protected double learningRate
defaultLearningRate.
| Constructor Detail |
|---|
public StochasticGradientDescent()
public StochasticGradientDescent(double r)
r - The desired learning rate value.public StochasticGradientDescent(StochasticGradientDescent.Parameters p)
StochasticGradientDescent.Parameters object.
p - The settings of all parameters.public StochasticGradientDescent(java.lang.String n)
n - The name of the classifier.
public StochasticGradientDescent(java.lang.String n,
double r)
SparseWeightVector.
n - The name of the classifier.r - The desired learning rate value.
public StochasticGradientDescent(java.lang.String n,
StochasticGradientDescent.Parameters p)
StochasticGradientDescent.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 t)
learningRate member variable to the specified
value.
t - The new value for learningRate.public void forget()
forget in class Learnerpublic java.lang.String getOutputType()
getOutputType in class Classifier"real"public void learn(java.lang.Object example)
learn in class Learnerexample - An example of the desired learned classifier's behavior.public ScoreSet scores(java.lang.Object example)
scores in class Learnerexample - The object to make decisions about.
nullpublic FeatureVector classify(java.lang.Object example)
classify in class Classifierexample - The example to be evaluated.
public void write(java.io.PrintStream out)
learningRate and 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 | |||||||||