@PublicationReference(author="Nick Littlestone", title="Learning Quickly When Irrelevant Attributes Abound: A New Linear-threshold Algorithm", year=1988, type=Journal, publication="Machine Learning", pages={285,318}) public class Winnow extends AbstractOnlineLinearBinaryCategorizerLearner
Modifier and Type | Field and Description |
---|---|
static boolean |
DEFAULT_DEMOTE_TO_ZERO
The default value of demoteToZero is false.
|
static double |
DEFAULT_WEIGHT_UPDATE
The default value of the weight update is 2.0.
|
protected boolean |
demoteToZero
An option to demote to zero.
|
protected double |
weightUpdate
The amount of the weight update (alpha).
|
protected double |
weightUpdateInverse
The cached value of the inverse of weight update (commonly alpha or
1 + epsilon).
|
vectorFactory
Constructor and Description |
---|
Winnow()
Creates a new
Winnow with default parameters. |
Winnow(double weightUpdate)
Creates a new
Winnow with the given weight update and the
default demote to zero (false). |
Winnow(double weightUpdate,
boolean demoteToZero)
Creates a new
Winnow with the given parameters. |
Modifier and Type | Method and Description |
---|---|
Winnow |
clone()
This makes public the clone method on the
Object class and
removes the exception that it throws. |
LinearBinaryCategorizer |
createInitialLearnedObject()
Creates a new initial learned object, before any data is given.
|
double |
getWeightUpdate()
Gets the multiplicative weight update term.
|
boolean |
isDemoteToZero()
Gets whether or not the algorithm will demote features involved in an
incorrect categorization to zero (Winnow1).
|
void |
setDemoteToZero(boolean demoteToZero)
Sets whether or not the algorithm will demote features involved in an
incorrect categorization to zero (Winnow1).
|
void |
setWeightUpdate(double weightUpdate)
Sets the multiplicative weight update term.
|
void |
update(LinearBinaryCategorizer target,
Vector input,
boolean actual)
The
update method updates an object of ResultType using
the given a new supervised input-output pair, using some form of
"learning" algorithm. |
getVectorFactory, setVectorFactory, update
update
learn, learn, update
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
learn
learn
update
public static final double DEFAULT_WEIGHT_UPDATE
public static final boolean DEFAULT_DEMOTE_TO_ZERO
protected double weightUpdate
protected boolean demoteToZero
protected double weightUpdateInverse
public Winnow()
Winnow
with default parameters.public Winnow(double weightUpdate)
Winnow
with the given weight update and the
default demote to zero (false).weightUpdate
- The multiplicative factor to update the weights. Must be greater
than one.public Winnow(double weightUpdate, boolean demoteToZero)
Winnow
with the given parameters.weightUpdate
- The multiplicative factor to update the weights. Must be greater
than one.demoteToZero
- True to demote to zero (Winnow1) and false to demote by dividing by
the weight (Winnow2).public Winnow clone()
AbstractCloneableSerializable
Object
class and
removes the exception that it throws. Its default behavior is to
automatically create a clone of the exact type of object that the
clone is called on and to copy all primitives but to keep all references,
which means it is a shallow copy.
Extensions of this class may want to override this method (but call
super.clone()
to implement a "smart copy". That is, to target
the most common use case for creating a copy of the object. Because of
the default behavior being a shallow copy, extending classes only need
to handle fields that need to have a deeper copy (or those that need to
be reset). Some of the methods in ObjectUtil
may be helpful in
implementing a custom clone method.
Note: The contract of this method is that you must use
super.clone()
as the basis for your implementation.clone
in interface CloneableSerializable
clone
in class AbstractBatchAndIncrementalLearner<InputOutputPair<? extends Vectorizable,java.lang.Boolean>,LinearBinaryCategorizer>
public LinearBinaryCategorizer createInitialLearnedObject()
IncrementalLearner
createInitialLearnedObject
in interface IncrementalLearner<InputOutputPair<? extends Vectorizable,java.lang.Boolean>,LinearBinaryCategorizer>
createInitialLearnedObject
in class AbstractOnlineLinearBinaryCategorizerLearner
public void update(LinearBinaryCategorizer target, Vector input, boolean actual)
AbstractOnlineLinearBinaryCategorizerLearner
update
method updates an object of ResultType
using
the given a new supervised input-output pair, using some form of
"learning" algorithm.update
in class AbstractOnlineLinearBinaryCategorizerLearner
target
- The object to update.input
- The supervised input vector to learn from.actual
- The supervised output label to learn from.public double getWeightUpdate()
public void setWeightUpdate(double weightUpdate)
weightUpdate
- The multiplicative factor to update the weights. Must be greater
than one.public boolean isDemoteToZero()
public void setDemoteToZero(boolean demoteToZero)
demoteToZero
- True to demote to zero (Winnow1) and false to demote by dividing by
the weight (Winnow2).