Budget maintenance strategy merging vectors. More...
#include <shark/Algorithms/Trainers/Budgeted/MergeBudgetMaintenanceStrategy.h>
Classes | |
struct | MergingProblemFunction |
Public Member Functions | |
virtual void | reduceBudget (ModelType &model, size_t firstIndex) |
virtual void | addToModel (ModelType &model, InputType const &alpha, ElementType const &supportVector) |
std::string | name () const |
class name More... | |
Public Member Functions inherited from shark::AbstractBudgetMaintenanceStrategy< RealVector > | |
AbstractBudgetMaintenanceStrategy () | |
std::string | name () const |
return the class name More... | |
Additional Inherited Members | |
Public Types inherited from shark::AbstractBudgetMaintenanceStrategy< RealVector > | |
typedef KernelExpansion< RealVector > | ModelType |
typedef LabeledData< RealVector, unsigned int > | DataType |
typedef DataType::element_type | ElementType |
Static Public Member Functions inherited from shark::AbstractBudgetMaintenanceStrategy< RealVector > | |
static void | findSmallestVector (ModelType const &model, size_t &minIndex, double &minAlpha) |
Budget maintenance strategy merging vectors.
Definition at line 95 of file MergeBudgetMaintenanceStrategy.h.
|
inlinevirtual |
add a vector to the model. this will add the given vector to the model and merge the budget so that afterwards the budget size is kept the same. If the budget has a free entry anyway, no merging will be performed, but instead the given vector is simply added to the budget.
[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 |
Implements shark::AbstractBudgetMaintenanceStrategy< RealVector >.
Definition at line 318 of file MergeBudgetMaintenanceStrategy.h.
References shark::KernelExpansion< InputType >::basis(), shark::Data< Type >::element(), and shark::Data< Type >::numberOfElements().
|
inline |
class name
Definition at line 368 of file MergeBudgetMaintenanceStrategy.h.
|
inlinevirtual |
Reduce the budget. This is a helper routine. after the addToModel adds the new support vector to the end of the budget (it was chosen one bigger than the capacity), this routine will do the real merging. Given a index it will search for a second index, so that merging is 'optimal'. It then will perform the merging. After that the last budget vector will be freed again (by setting its alpha-coefficients to zero).
[in] | model | Model to work on |
[in] | firstIndex | The index of the first element of the pair to merge. |
Definition at line 188 of file MergeBudgetMaintenanceStrategy.h.
References shark::KernelExpansion< InputType >::alpha(), shark::KernelExpansion< InputType >::basis(), shark::Data< Type >::element(), shark::AbstractKernelFunction< InputTypeT >::eval(), h, shark::KernelExpansion< InputType >::kernel(), and shark::Data< Type >::numberOfElements().