|
||||||||||
| 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.SparseWinnow
public class SparseWinnow
Simple sparse Winnow implementation. It is assumed that
Learner.labeler is a single discrete classifier whose returned
feature values 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 |
SparseWinnow.Parameters
Simply a container for all of SparseWinnow's configurable
parameters. |
| Field Summary | |
|---|---|
protected double |
alpha
The rate at which weights are promoted; default defaultAlpha. |
protected double |
beta
The rate at which weights are demoted; default equal to 1 /
alpha. |
static double |
defaultAlpha
Default for alpha. |
static double |
defaultInitialWeight
Default for LinearThresholdUnit.initialWeight. |
static double |
defaultThreshold
Default for LinearThresholdUnit.threshold. |
| Fields inherited from class LBJ2.learn.LinearThresholdUnit |
|---|
allowableValues, bias, defaultThickness, 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 | |
|---|---|
SparseWinnow()
alpha, beta, and LinearThresholdUnit.threshold
take default values, while the name of the classifier gets the empty
string. |
|
SparseWinnow(double a)
Sets alpha to the specified value, beta to 1 /
alpha, and the LinearThresholdUnit.threshold takes the
default, while the name of the classifier gets the empty string. |
|
SparseWinnow(double a,
double b)
Sets alpha and beta to the specified values, and the
LinearThresholdUnit.threshold takes the default, while the name
of the classifier gets the empty string. |
|
SparseWinnow(double a,
double b,
double t)
Sets alpha, beta, and
LinearThresholdUnit.threshold to the specified values, while the
name of the classifier gets the empty string. |
|
SparseWinnow(double a,
double b,
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. |
|
SparseWinnow(double a,
double b,
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. |
|
SparseWinnow(double a,
double b,
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. |
|
SparseWinnow(SparseWinnow.Parameters p)
Initializing constructor. |
|
SparseWinnow(java.lang.String n)
alpha, beta, and LinearThresholdUnit.threshold
take default values. |
|
SparseWinnow(java.lang.String n,
double a)
Sets alpha to the specified value, beta to 1 /
alpha, and the LinearThresholdUnit.threshold takes the
default. |
|
SparseWinnow(java.lang.String n,
double a,
double b)
Sets alpha and beta to the specified values, and the
LinearThresholdUnit.threshold takes the default. |
|
SparseWinnow(java.lang.String n,
double a,
double b,
double t)
Sets alpha, beta, and
LinearThresholdUnit.threshold to the specified values. |
|
SparseWinnow(java.lang.String n,
double a,
double b,
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. |
|
SparseWinnow(java.lang.String n,
double a,
double b,
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. |
|
SparseWinnow(java.lang.String n,
double a,
double b,
double t,
double pt,
double nt,
SparseWeightVector v)
Use this constructor to specify an alternative subclass of SparseWeightVector. |
|
SparseWinnow(java.lang.String n,
SparseWinnow.Parameters p)
Initializing constructor. |
|
| Method Summary | |
|---|---|
java.lang.Object |
clone()
Returns a deep clone of this learning algorithm. |
void |
demote(java.lang.Object example)
Demotion is simply w_i *= betax_i. |
double |
getAlpha()
Returns the current value of the alpha variable. |
double |
getBeta()
Returns the current value of the beta variable. |
void |
promote(java.lang.Object example)
Promotion is simply w_i *= alphax_i. |
void |
setAlpha(double t)
Sets the alpha member variable to the specified value. |
void |
setBeta(double t)
Sets the beta member variable to the specified value. |
void |
update(java.lang.Object example,
double base)
This method performs an update w_i *= basex_i,
initalizing weights in the weight vector as needed. |
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 defaultAlpha
alpha.
public static final double defaultThreshold
LinearThresholdUnit.threshold.
public static final double defaultInitialWeight
LinearThresholdUnit.initialWeight.
protected double alpha
defaultAlpha.
protected double beta
1 /
alpha.
| Constructor Detail |
|---|
public SparseWinnow()
alpha, beta, and LinearThresholdUnit.threshold
take default values, while the name of the classifier gets the empty
string.
public SparseWinnow(double a)
alpha to the specified value, beta to 1 /
alpha, and the LinearThresholdUnit.threshold takes the
default, while the name of the classifier gets the empty string.
a - The desired value of the promotion parameter.
public SparseWinnow(double a,
double b)
alpha and beta to the specified values, and the
LinearThresholdUnit.threshold takes the default, while the name
of the classifier gets the empty string.
a - The desired value of the promotion parameter.b - The desired value of the demotion parameter.
public SparseWinnow(double a,
double b,
double t)
alpha, beta, and
LinearThresholdUnit.threshold to the specified values, while the
name of the classifier gets the empty string.
a - The desired value of the promotion parameter.b - The desired value of the demotion parameter.t - The desired threshold value.
public SparseWinnow(double a,
double b,
double t,
double pt)
a - The desired value of the promotion parameter.b - The desired value of the demotion parameter.t - The desired threshold value.pt - The desired positive thickness.
public SparseWinnow(double a,
double b,
double t,
double pt,
double nt)
a - The desired value of the promotion parameter.b - The desired value of the demotion parameter.t - The desired threshold value.pt - The desired positive thickness.nt - The desired negative thickness.
public SparseWinnow(double a,
double b,
double t,
double pt,
double nt,
SparseWeightVector v)
SparseWeightVector, while the name of the classifier gets the
empty string.
a - The desired value of the promotion parameter.b - The desired value of the demotion parameter.t - The desired threshold value.pt - The desired positive thickness.nt - The desired negative thickness.v - An empty sparse weight vector.public SparseWinnow(SparseWinnow.Parameters p)
SparseWinnow.Parameters object.
p - The settings of all parameters.public SparseWinnow(java.lang.String n)
alpha, beta, and LinearThresholdUnit.threshold
take default values.
n - The name of the classifier.
public SparseWinnow(java.lang.String n,
double a)
alpha to the specified value, beta to 1 /
alpha, and the LinearThresholdUnit.threshold takes the
default.
n - The name of the classifier.a - The desired value of the promotion parameter.
public SparseWinnow(java.lang.String n,
double a,
double b)
alpha and beta to the specified values, and the
LinearThresholdUnit.threshold takes the default.
n - The name of the classifier.a - The desired value of the promotion parameter.b - The desired value of the demotion parameter.
public SparseWinnow(java.lang.String n,
double a,
double b,
double t)
alpha, beta, and
LinearThresholdUnit.threshold to the specified values.
n - The name of the classifier.a - The desired value of the promotion parameter.b - The desired value of the demotion parameter.t - The desired threshold value.
public SparseWinnow(java.lang.String n,
double a,
double b,
double t,
double pt)
n - The name of the classifier.a - The desired value of the promotion parameter.b - The desired value of the demotion parameter.t - The desired threshold value.pt - The desired positive thickness.
public SparseWinnow(java.lang.String n,
double a,
double b,
double t,
double pt,
double nt)
n - The name of the classifier.a - The desired value of the promotion parameter.b - The desired value of the demotion parameter.t - The desired threshold value.pt - The desired positive thickness.nt - The desired negative thickness.
public SparseWinnow(java.lang.String n,
double a,
double b,
double t,
double pt,
double nt,
SparseWeightVector v)
SparseWeightVector.
n - The name of the classifier.a - The desired value of the promotion parameter.b - The desired value of the demotion parameter.t - The desired threshold value.pt - The desired positive thickness.nt - The desired negative thickness.v - An empty sparse weight vector.
public SparseWinnow(java.lang.String n,
SparseWinnow.Parameters p)
SparseWinnow.Parameters object.
n - The name of the classifier.p - The settings of all parameters.| Method Detail |
|---|
public double getAlpha()
alpha variable.
alpha variable.public void setAlpha(double t)
alpha member variable to the specified value.
t - The new value for alpha.public double getBeta()
beta variable.
beta variable.public void setBeta(double t)
beta member variable to the specified value.
t - The new value for beta.public void promote(java.lang.Object example)
w_i *= alphax_i.
promote in class LinearThresholdUnitexample - The example object.public void demote(java.lang.Object example)
w_i *= betax_i.
demote in class LinearThresholdUnitexample - The example object.
public void update(java.lang.Object example,
double base)
w_i *= basex_i,
initalizing weights in the weight vector as needed.
example - The example object.base - As described above.public void write(java.io.PrintStream out)
alpha, beta,
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 | |||||||||