shark::QpMcBoxDecomp< Matrix > Class Template Reference

#include <shark/Algorithms/QP/QpMcBoxDecomp.h>

Classes

struct  Example
 data structure describing one training example More...
 
struct  PreferedSelectionStrategy
 Working set selection eturning th S2DO working set. More...
 
struct  Variable
 data structure describing one m_variables of the problem More...
 

Public Types

typedef Matrix::QpFloatType QpFloatType
 

Public Member Functions

 QpMcBoxDecomp (Matrix &kernel, QpSparseArray< QpFloatType > const &M, Data< unsigned int > const &target, RealMatrix const &linearMat, double C)
 
void setShrinking (bool shrinking=true)
 enable/disable shrinking More...
 
RealMatrix solution () const
 Return the solution found. More...
 
RealMatrix solutionGradient () const
 Return the gradient of the solution. More...
 
double functionValue () const
 Compute the objective value of the current solution. More...
 
unsigned int label (std::size_t i)
 
std::size_t dimensions () const
 
std::size_t cardP () const
 
std::size_t getNumExamples () const
 
double checkKKT () const
 return the largest KKT violation More...
 
void addDeltaLinear (RealMatrix const &deltaLinear)
 change the linear part of the problem by some delta More...
 
void updateSMO (std::size_t v, std::size_t w)
 
bool shrink (double epsilon)
 Shrink the problem. More...
 
void unshrink ()
 Activate all m_numVariables. More...
 
double selectWorkingSet (std::size_t &i, std::size_t &j)
 select the working set More...
 

Protected Member Functions

void gradientUpdate (std::size_t r, double mu, float *q)
 
void deactivateVariable (std::size_t v)
 shrink a variable More...
 
void deactivateExample (std::size_t e)
 shrink an m_examples More...
 
std::size_t originalIndex (std::size_t v) const
 Returns the original index of the example of a variable in the dataset before optimization. More...
 

Protected Attributes

bool bUnshrinked
 true if the problem has already been unshrinked More...
 
Matrix & m_kernelMatrix
 kernel matrix (precomputed matrix or matrix cache) More...
 
QpSparseArray< QpFloatType > const & m_M
 kernel modifiers More...
 
double m_C
 complexity constant; upper bound on all variabless More...
 
unsigned int m_classes
 number of m_classes in the problem More...
 
unsigned int m_cardP
 number of dual m_numVariables per example More...
 
std::size_t m_numExamples
 number of m_examples in the problem (size of the kernel matrix) More...
 
std::size_t m_numVariables
 number of m_numVariables in the problem = m_examples times m_cardP More...
 
RealVector m_linear
 m_linear part of the objective function More...
 
RealVector m_alpha
 solution candidate More...
 
RealVector m_gradient
 
std::vector< Examplem_examples
 information about each training example More...
 
std::vector< Variablem_variables
 information about each m_variables of the problem More...
 
std::vector< std::size_t > m_storage1
 space for the example[i].var pointers More...
 
std::vector< std::size_t > m_storage2
 space for the example[i].avar pointers More...
 
std::size_t m_activeEx
 number of currently active m_examples More...
 
std::size_t m_activeVar
 number of currently active variabless More...
 
bool m_useShrinking
 should the m_problem use the shrinking heuristics? More...
 

Detailed Description

template<class Matrix>
class shark::QpMcBoxDecomp< Matrix >

Definition at line 50 of file QpMcBoxDecomp.h.

Member Typedef Documentation

§ QpFloatType

template<class Matrix>
typedef Matrix::QpFloatType shark::QpMcBoxDecomp< Matrix >::QpFloatType

Definition at line 53 of file QpMcBoxDecomp.h.

Constructor & Destructor Documentation

§ QpMcBoxDecomp()

template<class Matrix>
shark::QpMcBoxDecomp< Matrix >::QpMcBoxDecomp ( Matrix &  kernel,
QpSparseArray< QpFloatType > const &  M,
Data< unsigned int > const &  target,
RealMatrix const &  linearMat,
double  C 
)
inline

Member Function Documentation

§ addDeltaLinear()

§ cardP()

template<class Matrix>
std::size_t shark::QpMcBoxDecomp< Matrix >::cardP ( ) const
inline

§ checkKKT()

template<class Matrix>
double shark::QpMcBoxDecomp< Matrix >::checkKKT ( ) const
inline

§ deactivateExample()

§ deactivateVariable()

§ dimensions()

template<class Matrix>
std::size_t shark::QpMcBoxDecomp< Matrix >::dimensions ( ) const
inline

Definition at line 165 of file QpMcBoxDecomp.h.

References shark::QpMcBoxDecomp< Matrix >::m_numVariables.

§ functionValue()

template<class Matrix>
double shark::QpMcBoxDecomp< Matrix >::functionValue ( ) const
inline

§ getNumExamples()

template<class Matrix>
std::size_t shark::QpMcBoxDecomp< Matrix >::getNumExamples ( ) const
inline

Definition at line 172 of file QpMcBoxDecomp.h.

References shark::QpMcBoxDecomp< Matrix >::m_numExamples.

§ gradientUpdate()

§ label()

template<class Matrix>
unsigned int shark::QpMcBoxDecomp< Matrix >::label ( std::size_t  i)
inline

Definition at line 161 of file QpMcBoxDecomp.h.

References shark::QpMcBoxDecomp< Matrix >::m_examples.

§ originalIndex()

template<class Matrix>
std::size_t shark::QpMcBoxDecomp< Matrix >::originalIndex ( std::size_t  v) const
inlineprotected

Returns the original index of the example of a variable in the dataset before optimization.

Shrinking is an internal detail so the communication with the outside world uses the original indizes.

Definition at line 551 of file QpMcBoxDecomp.h.

References shark::QpMcBoxDecomp< Matrix >::m_examples, and shark::QpMcBoxDecomp< Matrix >::m_variables.

Referenced by shark::QpMcBoxDecomp< Matrix >::addDeltaLinear(), shark::QpMcBoxDecomp< Matrix >::solution(), and shark::QpMcBoxDecomp< Matrix >::solutionGradient().

§ selectWorkingSet()

template<class Matrix>
double shark::QpMcBoxDecomp< Matrix >::selectWorkingSet ( std::size_t &  i,
std::size_t &  j 
)
inline

§ setShrinking()

template<class Matrix>
void shark::QpMcBoxDecomp< Matrix >::setShrinking ( bool  shrinking = true)
inline

enable/disable shrinking

Definition at line 132 of file QpMcBoxDecomp.h.

References shark::QpMcBoxDecomp< Matrix >::m_useShrinking.

§ shrink()

§ solution()

§ solutionGradient()

template<class Matrix>
RealMatrix shark::QpMcBoxDecomp< Matrix >::solutionGradient ( ) const
inline

§ unshrink()

§ updateSMO()

Member Data Documentation

§ bUnshrinked

template<class Matrix>
bool shark::QpMcBoxDecomp< Matrix >::bUnshrinked
protected

true if the problem has already been unshrinked

Definition at line 486 of file QpMcBoxDecomp.h.

Referenced by shark::QpMcBoxDecomp< Matrix >::shrink().

§ m_activeEx

§ m_activeVar

§ m_alpha

§ m_C

template<class Matrix>
double shark::QpMcBoxDecomp< Matrix >::m_C
protected

§ m_cardP

§ m_classes

§ m_examples

§ m_gradient

§ m_kernelMatrix

§ m_linear

§ m_M

§ m_numExamples

template<class Matrix>
std::size_t shark::QpMcBoxDecomp< Matrix >::m_numExamples
protected

§ m_numVariables

§ m_storage1

template<class Matrix>
std::vector<std::size_t> shark::QpMcBoxDecomp< Matrix >::m_storage1
protected

space for the example[i].var pointers

Definition at line 622 of file QpMcBoxDecomp.h.

Referenced by shark::QpMcBoxDecomp< Matrix >::QpMcBoxDecomp().

§ m_storage2

template<class Matrix>
std::vector<std::size_t> shark::QpMcBoxDecomp< Matrix >::m_storage2
protected

space for the example[i].avar pointers

Definition at line 625 of file QpMcBoxDecomp.h.

Referenced by shark::QpMcBoxDecomp< Matrix >::QpMcBoxDecomp().

§ m_useShrinking

template<class Matrix>
bool shark::QpMcBoxDecomp< Matrix >::m_useShrinking
protected

should the m_problem use the shrinking heuristics?

Definition at line 634 of file QpMcBoxDecomp.h.

Referenced by shark::QpMcBoxDecomp< Matrix >::setShrinking(), and shark::QpMcBoxDecomp< Matrix >::shrink().

§ m_variables


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