public abstract class AbstractLinearCombinationOnlineLearner extends AbstractKernelizableBinaryCategorizerOnlineLearner
Modifier and Type | Field and Description |
---|---|
protected boolean |
updateBias
An option controlling whether or not the bias is updated or not.
|
vectorFactory
Constructor and Description |
---|
AbstractLinearCombinationOnlineLearner(boolean updateBias)
Creates a new
AbstractLinearCombinationOnlineLearner with
default parameters. |
AbstractLinearCombinationOnlineLearner(boolean updateBias,
VectorFactory<?> vectorFactory)
Creates a new
AbstractLinearCombinationOnlineLearner 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.
|
protected <InputType> |
computeRescaling(DefaultKernelBinaryCategorizer<InputType> target,
InputType input,
boolean actualCategory,
double predicted,
double update,
double decay)
Computes the rescaling for the new weights.
|
protected double |
computeRescaling(LinearBinaryCategorizer target,
Vector input,
boolean actualCategory,
double predicted,
double update,
double decay)
Computes the rescaling for the new weight vector.
|
protected abstract <InputType> |
computeUpdate(DefaultKernelBinaryCategorizer<InputType> target,
InputType input,
boolean actualCategory,
double predicted)
Compute the update weight in the linear case.
|
protected abstract double |
computeUpdate(LinearBinaryCategorizer target,
Vector input,
boolean actualCategory,
double predicted)
Compute the update weight in the linear case.
|
<InputType> |
createInitialLearnedObject(Kernel<? super InputType> kernel)
Creates the initial learned object with a given kernel.
|
protected <InputType> |
initialize(DefaultKernelBinaryCategorizer<InputType> target,
InputType input,
boolean actualCategory)
Initializes the kernel binary categorizer.
|
protected void |
initialize(LinearBinaryCategorizer target,
Vector input,
boolean actualCategory)
Initializes the linear binary categorizer.
|
boolean |
isUpdateBias()
Gets whether or not the algorithm is updating the bias.
|
protected void |
setUpdateBias(boolean updateBias)
Sets whether or not the algorithm is updating the bias.
|
<InputType> |
update(DefaultKernelBinaryCategorizer<InputType> target,
InputType input,
boolean output)
Performs a kernel-based incremental update step on the given object
using the given supervised data.
|
void |
update(LinearBinaryCategorizer target,
Vector input,
boolean label)
The
update method updates an object of ResultType using
the given a new supervised input-output pair, using some form of
"learning" algorithm. |
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
protected boolean updateBias
public AbstractLinearCombinationOnlineLearner(boolean updateBias)
AbstractLinearCombinationOnlineLearner
with
default parameters.updateBias
- Whether or not the bias should be updated by the algorithm.public AbstractLinearCombinationOnlineLearner(boolean updateBias, VectorFactory<?> vectorFactory)
AbstractLinearCombinationOnlineLearner
with
the given parameters.updateBias
- Whether or not the bias should be updated by the algorithm.vectorFactory
- The vector factory to use.public void update(LinearBinaryCategorizer target, Vector input, boolean label)
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.label
- The supervised output label to learn from.public <InputType> DefaultKernelBinaryCategorizer<InputType> createInitialLearnedObject(Kernel<? super InputType> kernel)
KernelizableBinaryCategorizerOnlineLearner
createInitialLearnedObject
in interface KernelizableBinaryCategorizerOnlineLearner
createInitialLearnedObject
in class AbstractKernelizableBinaryCategorizerOnlineLearner
InputType
- The input type for supervised learning. Will be passed to the
kernel function.kernel
- The kernel function to use.public <InputType> void update(DefaultKernelBinaryCategorizer<InputType> target, InputType input, boolean output)
KernelizableBinaryCategorizerOnlineLearner
InputType
- The input type for supervised learning. Will be passed to the
kernel function.target
- The target object to update.input
- The supervised input value.output
- The supervised output value (label).protected void initialize(LinearBinaryCategorizer target, Vector input, boolean actualCategory)
target
- The categorizer to initialize.input
- The first input seen.actualCategory
- The actual category of the first input.protected abstract double computeUpdate(LinearBinaryCategorizer target, Vector input, boolean actualCategory, double predicted)
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.protected double computeDecay(LinearBinaryCategorizer target, Vector input, boolean actualCategory, double predicted, double update)
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 double computeRescaling(LinearBinaryCategorizer target, Vector input, boolean actualCategory, double predicted, double update, double decay)
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.decay
- The value from the computeDecay step.protected <InputType> void initialize(DefaultKernelBinaryCategorizer<InputType> target, InputType input, boolean actualCategory)
InputType
- The input value for learning.target
- The categorizer to initialize.input
- The first input seen.actualCategory
- The actual category of the first input.protected abstract <InputType> double computeUpdate(DefaultKernelBinaryCategorizer<InputType> target, InputType input, boolean actualCategory, double predicted)
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.protected <InputType> double computeDecay(DefaultKernelBinaryCategorizer<InputType> target, InputType input, boolean actualCategory, double predicted, double update)
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.protected <InputType> double computeRescaling(DefaultKernelBinaryCategorizer<InputType> target, InputType input, boolean actualCategory, double predicted, double update, double decay)
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.decay
- The value from the computeDecay step.public boolean isUpdateBias()
protected void setUpdateBias(boolean updateBias)
updateBias
- True if the algorithm is updating the bias. Otherwise, false.