shark::MergeBudgetMaintenanceStrategy< RealVector > Class Template Reference

Budget maintenance strategy merging vectors. More...

#include <shark/Algorithms/Trainers/Budgeted/MergeBudgetMaintenanceStrategy.h>

+ Inheritance diagram for shark::MergeBudgetMaintenanceStrategy< RealVector >:

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)
 

Detailed Description

template<>
class shark::MergeBudgetMaintenanceStrategy< RealVector >

Budget maintenance strategy merging vectors.

This is an specialization of the merge budget maintenance strategy
that handles simple real-valued vectors. This is a nearly 1:1 adoption of the strategy presented in Wang, Cramer and Vucetic.

Definition at line 95 of file MergeBudgetMaintenanceStrategy.h.

Member Function Documentation

◆ addToModel()

virtual void shark::MergeBudgetMaintenanceStrategy< RealVector >::addToModel ( ModelType model,
InputType const &  alpha,
ElementType const &  supportVector 
)
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.

Parameters
[in,out]modelthe model the strategy will work with
[in]alphaalphas for the new budget vector
[in]supportVectorthe 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().

◆ name()

std::string shark::MergeBudgetMaintenanceStrategy< RealVector >::name ( ) const
inline

class name

Definition at line 368 of file MergeBudgetMaintenanceStrategy.h.

◆ reduceBudget()

virtual void shark::MergeBudgetMaintenanceStrategy< RealVector >::reduceBudget ( ModelType model,
size_t  firstIndex 
)
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).

Parameters
[in]modelModel to work on
[in]firstIndexThe 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().


The documentation for this class was generated from the following file: