This is the abstract interface for any budget maintenance strategy. More...
#include <shark/Algorithms/Trainers/Budgeted/AbstractBudgetMaintenanceStrategy.h>
Public Types | |
typedef KernelExpansion< InputType > | ModelType |
typedef LabeledData< InputType, unsigned int > | DataType |
typedef DataType::element_type | ElementType |
Public Member Functions | |
AbstractBudgetMaintenanceStrategy () | |
virtual void | addToModel (ModelType &model, InputType const &alpha, ElementType const &supportVector)=0 |
std::string | name () const |
return the class name More... | |
Static Public Member Functions | |
static void | findSmallestVector (ModelType const &model, size_t &minIndex, double &minAlpha) |
This is the abstract interface for any budget maintenance strategy.
To allow for easy exchange of budget maintenance strategies, each of them should derive from this class. The only function it defines is addToModel, which, when implemented, will add a given supportvector and given alphas to the provided model by applying the respective budget maintenance strategy. (Note that not all merging strategies need the alphas, but some do)
Definition at line 62 of file AbstractBudgetMaintenanceStrategy.h.
typedef LabeledData<InputType, unsigned int> shark::AbstractBudgetMaintenanceStrategy< InputType >::DataType |
Definition at line 67 of file AbstractBudgetMaintenanceStrategy.h.
typedef DataType::element_type shark::AbstractBudgetMaintenanceStrategy< InputType >::ElementType |
Definition at line 68 of file AbstractBudgetMaintenanceStrategy.h.
typedef KernelExpansion<InputType> shark::AbstractBudgetMaintenanceStrategy< InputType >::ModelType |
Definition at line 66 of file AbstractBudgetMaintenanceStrategy.h.
|
inline |
Definition at line 70 of file AbstractBudgetMaintenanceStrategy.h.
|
pure virtual |
this is the main interface, which adds a given supportvector with given alpha coefficients to the model.
[in,out] | model | the model the strategy will work with |
[in] | alpha | alphas for the new budget vector |
[in] | supportVector | the vector to add to the model by applying the maintenance strategy |
Implemented in shark::MergeBudgetMaintenanceStrategy< RealVector >, shark::RemoveBudgetMaintenanceStrategy< InputType >, and shark::ProjectBudgetMaintenanceStrategy< InputType >.
Referenced by shark::AbstractBudgetMaintenanceStrategy< RealVector >::AbstractBudgetMaintenanceStrategy().
|
inlinestatic |
this will find the vector with the smallest alpha, measured in 2-norm in the given model. now there is a special case: if there is somewhere a zero coefficient, then obviously this is the smallest element. in this case we just proceed as usual. the caller must decide what to do with such a vector.
[in] | model | the model we want to search |
[out] | minIndex | the index of the vector with smallest coefficient |
[out] | minAlpha | the 2-norm of the alpha coefficient of the found vector |
Definition at line 95 of file AbstractBudgetMaintenanceStrategy.h.
Referenced by shark::RemoveBudgetMaintenanceStrategy< InputType >::addToModel().
|
inline |
return the class name
Definition at line 117 of file AbstractBudgetMaintenanceStrategy.h.
Referenced by main().