@PublicationReference(title="Online Passive-Aggressive Algorithms", author={"Koby Crammer","Ofer Dekel","Joseph Keshet","Shai Shalev-Shwartz","Yoram Singer"}, year=2006, type=Journal, publication="Journal of Machine Learning Research", pages={551,585}, url="http://jmlr.org/papers/volume7/crammer06a/crammer06a.pdf") public class OnlinePassiveAggressivePerceptron extends AbstractLinearCombinationOnlineLearner
LinearSoftMargin
and QuadraticSoftMargin
implement the soft-margin variants (PA-I and PA-II).
Modifier and Type | Class and Description |
---|---|
static class |
OnlinePassiveAggressivePerceptron.AbstractSoftMargin
An abstract class for soft-margin versions of the Passive-Aggressive
algorithm.
|
static class |
OnlinePassiveAggressivePerceptron.LinearSoftMargin
An implementation of the linear soft-margin variant of the Passive-
Aggressive algorithm (PA-I).
|
static class |
OnlinePassiveAggressivePerceptron.QuadraticSoftMargin
An implementation of the quadratic soft-margin variant of the Passive-
Aggressive algorithm (PA-II).
|
Modifier and Type | Field and Description |
---|---|
static boolean |
DEFAULT_UPDATE_BIAS
By default the Passive-Aggressive Perceptron does not use a bias.
|
updateBias
vectorFactory
Constructor and Description |
---|
OnlinePassiveAggressivePerceptron()
Creates a new
OnlinePassiveAggressivePerceptron . |
OnlinePassiveAggressivePerceptron(VectorFactory<?> vectorFactory)
Creates a new
OnlinePassiveAggressivePerceptron with the given
vector factory. |
Modifier and Type | Method and Description |
---|---|
<InputType> |
computeUpdate(DefaultKernelBinaryCategorizer<InputType> target,
InputType input,
boolean actualCategory,
double predicted)
Compute the update weight in the linear case.
|
protected double |
computeUpdate(double actual,
double predicted,
double loss,
double inputNorm2Squared)
Compute the update value (tau) for the algorithm.
|
double |
computeUpdate(LinearBinaryCategorizer target,
Vector input,
boolean actualCategory,
double predicted)
Compute the update weight in the linear case.
|
computeDecay, computeDecay, computeRescaling, computeRescaling, createInitialLearnedObject, initialize, initialize, isUpdateBias, setUpdateBias, update, update
createKernelLearner, learn, update, update, update
createInitialLearnedObject, getVectorFactory, setVectorFactory, update
update
clone, learn, learn, update
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
update
learn
learn
createInitialLearnedObject, update, update
clone
public static final boolean DEFAULT_UPDATE_BIAS
public OnlinePassiveAggressivePerceptron()
OnlinePassiveAggressivePerceptron
.public OnlinePassiveAggressivePerceptron(VectorFactory<?> vectorFactory)
OnlinePassiveAggressivePerceptron
with the given
vector factory.vectorFactory
- The vector factory to use.protected double computeUpdate(double actual, double predicted, double loss, double inputNorm2Squared)
actual
- The actual label represented as a double (-1 or +1).predicted
- The value predicted by the current categorizer (w * x + b).loss
- The loss function (1 - predicted).inputNorm2Squared
- The squared 2-norm of the input (||x||^2).public double computeUpdate(LinearBinaryCategorizer target, Vector input, boolean actualCategory, double predicted)
AbstractLinearCombinationOnlineLearner
computeUpdate
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.public <InputType> double computeUpdate(DefaultKernelBinaryCategorizer<InputType> target, InputType input, boolean actualCategory, 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.actualCategory
- The actual category of the input.predicted
- The predicted category of the input.