@PublicationReference(author={"Giovanni Cavallanti","Nicolo Cesa-Bianchi","Claudio Gentile"}, title="Tracking the best hyperplane with a simple budget Perceptron", year=2007, type=Journal, publication="Machine Learning", pages={143,167}, url="http://www.springerlink.com/index/H40NV525LX161227.pdf") public class OnlineShiftingPerceptron extends AbstractLinearCombinationOnlineLearner
Modifier and Type | Class and Description |
---|---|
static class |
OnlineShiftingPerceptron.LinearResult
This is the result learned by the shifting perceptron.
|
Modifier and Type | Field and Description |
---|---|
static double |
DEFAULT_LAMBDA
The default value of lambda is 0.001.
|
static boolean |
DEFAULT_UPDATE_BIAS
Algorithm does not update the bias by default.
|
protected double |
lambda
The lambda parameter for controlling how much shifting occurs.
|
updateBias
vectorFactory
Constructor and Description |
---|
OnlineShiftingPerceptron()
Creates a new
OnlineShiftingPerceptron with default parameters. |
OnlineShiftingPerceptron(double lambda)
Creates a new
OnlineShiftingPerceptron with the given parameters. |
OnlineShiftingPerceptron(double lambda,
VectorFactory<?> vectorFactory)
Creates a new
OnlineShiftingPerceptron with the given parameters. |
Modifier and Type | Method and Description |
---|---|
protected <InputType> |
computeDecay(DefaultKernelBinaryCategorizer<InputType> target,
InputType input,
boolean actualCategory,
double predicted,
double update)
Computes the decay scalar for the existing weights.
|
protected double |
computeDecay(LinearBinaryCategorizer target,
Vector input,
boolean actualCategory,
double predicted,
double update)
Computes the decay scalar for the existing weight vector.
|
<InputType> |
computeUpdate(DefaultKernelBinaryCategorizer<InputType> target,
InputType input,
boolean label,
double predicted)
Compute the update weight in the linear case.
|
double |
computeUpdate(LinearBinaryCategorizer target,
Vector input,
boolean label,
double predicted)
Compute the update weight in the linear case.
|
LinearBinaryCategorizer |
createInitialLearnedObject()
Creates a new initial learned object, before any data is given.
|
double |
getLambda()
Gets the lambda parameter, which controls how much shifting and decay
there is in the weight vector.
|
void |
setLambda(double lambda)
Sets the lambda parameter, which controls how much shifting and decay
there is in the weight vector.
|
computeRescaling, computeRescaling, createInitialLearnedObject, initialize, initialize, isUpdateBias, setUpdateBias, update, update
createKernelLearner, learn, update, update, update
getVectorFactory, setVectorFactory, update
update
clone, learn, learn, update
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
update
learn
learn
update, update
clone
public static final boolean DEFAULT_UPDATE_BIAS
public static final double DEFAULT_LAMBDA
protected double lambda
public OnlineShiftingPerceptron()
OnlineShiftingPerceptron
with default parameters.public OnlineShiftingPerceptron(double lambda)
OnlineShiftingPerceptron
with the given parameters.lambda
- The lambda parameter to control the amount of shift. Must be
positive.public OnlineShiftingPerceptron(double lambda, VectorFactory<?> vectorFactory)
OnlineShiftingPerceptron
with the given parameters.lambda
- The lambda parameter to control the amount of shift. Must be
positive.vectorFactory
- The vector factory to use.public LinearBinaryCategorizer createInitialLearnedObject()
IncrementalLearner
createInitialLearnedObject
in interface IncrementalLearner<InputOutputPair<? extends Vectorizable,java.lang.Boolean>,LinearBinaryCategorizer>
createInitialLearnedObject
in class AbstractOnlineLinearBinaryCategorizerLearner
public double computeUpdate(LinearBinaryCategorizer target, Vector input, boolean label, double predicted)
AbstractLinearCombinationOnlineLearner
computeUpdate
in class AbstractLinearCombinationOnlineLearner
target
- Target to compute the update for.input
- Input to use in computing the update.label
- The actual category of the input.predicted
- The predicted category of the input.public <InputType> double computeUpdate(DefaultKernelBinaryCategorizer<InputType> target, InputType input, boolean label, double predicted)
AbstractLinearCombinationOnlineLearner
computeUpdate
in class AbstractLinearCombinationOnlineLearner
InputType
- The input value for learning.target
- Target to compute the update for.input
- Input to use in computing the update.label
- The actual category of the input.predicted
- The predicted category of the input.protected double computeDecay(LinearBinaryCategorizer target, Vector input, boolean actualCategory, double predicted, double update)
AbstractLinearCombinationOnlineLearner
computeDecay
in class AbstractLinearCombinationOnlineLearner
target
- Target to compute the update for.input
- Input to use in computing the update.actualCategory
- The actual category of the input.predicted
- The predicted category of the input.update
- The value from the computeUpdate step.protected <InputType> double computeDecay(DefaultKernelBinaryCategorizer<InputType> target, InputType input, boolean actualCategory, double predicted, double update)
AbstractLinearCombinationOnlineLearner
computeDecay
in class AbstractLinearCombinationOnlineLearner
InputType
- The input value for learning.target
- Target to compute the update for.input
- Input to use in computing the update.actualCategory
- The actual category of the input.predicted
- The predicted category of the input.update
- The value from the computeUpdate step.public double getLambda()
public void setLambda(double lambda)
lambda
- The lambda parameter. Must be positive.