Super class of all linear SVM trainers. More...
#include <shark/Algorithms/Trainers/AbstractSvmTrainer.h>
Inheritance diagram for shark::AbstractLinearSvmTrainer< InputType >:Public Types | |
| typedef LinearClassifier< InputType > | ModelType |
Public Types inherited from shark::AbstractTrainer< LinearClassifier< InputType >, unsigned int > | |
| typedef LinearClassifier< InputType > | ModelType |
| typedef ModelType::InputType | InputType |
| typedef unsigned int | LabelType |
| typedef LabeledData< InputType, LabelType > | DatasetType |
Public Types inherited from shark::IParameterizable< VectorType > | |
| typedef VectorType | ParameterVectorType |
Public Member Functions | |
| AbstractLinearSvmTrainer (double C, bool offset, bool unconstrained) | |
| double | C () const |
| Return the value of the regularization parameter C. | |
| void | setC (double C) |
| Set the value of the regularization parameter C. | |
| bool | isUnconstrained () const |
| Is the regularization parameter provided in logarithmic (unconstrained) form as a parameter? | |
| bool | trainOffset () const |
| RealVector | parameterVector () const |
| Get the hyper-parameter vector. | |
| void | setParameterVector (RealVector const &newParameters) |
| Set the vector of hyper-parameters. | |
| size_t | numberOfParameters () const |
| Return the number of hyper-parameters. | |
Public Member Functions inherited from shark::AbstractTrainer< LinearClassifier< InputType >, unsigned int > | |
| virtual void | train (ModelType &model, DatasetType const &dataset)=0 |
| Core of the Trainer interface. | |
Public Member Functions inherited from shark::INameable | |
| virtual | ~INameable () |
| virtual std::string | name () const |
| returns the name of the object | |
Public Member Functions inherited from shark::ISerializable | |
| virtual | ~ISerializable () |
| Virtual d'tor. | |
| virtual void | read (InArchive &archive) |
| Read the component from the supplied archive. | |
| virtual void | write (OutArchive &archive) const |
| Write the component to the supplied archive. | |
| void | load (InArchive &archive, unsigned int version) |
| Versioned loading of components, calls read(...). | |
| void | save (OutArchive &archive, unsigned int version) const |
| Versioned storing of components, calls write(...). | |
| BOOST_SERIALIZATION_SPLIT_MEMBER () | |
Public Member Functions inherited from shark::QpConfig | |
| QpConfig (bool precomputedFlag=false, bool sparsifyFlag=true) | |
| Constructor. | |
| QpStoppingCondition & | stoppingCondition () |
| Read/write access to the stopping condition. | |
| QpStoppingCondition const & | stoppingCondition () const |
| Read access to the stopping condition. | |
| QpSolutionProperties & | solutionProperties () |
| Access to the solution properties. | |
| bool & | precomputeKernel () |
| Flag for using a precomputed kernel matrix. | |
| bool const & | precomputeKernel () const |
| Flag for using a precomputed kernel matrix. | |
| bool & | sparsify () |
| Flag for sparsifying the model after training. | |
| bool const & | sparsify () const |
| Flag for sparsifying the model after training. | |
| bool & | shrinking () |
| Flag for shrinking in the decomposition solver. | |
| bool const & | shrinking () const |
| Flag for shrinking in the decomposition solver. | |
| bool & | s2do () |
| Flag for S2DO (instead of SMO) | |
| bool const & | s2do () const |
| Flag for S2DO (instead of SMO) | |
| unsigned int & | verbosity () |
| Verbosity level of the solver. | |
| unsigned int const & | verbosity () const |
| Verbosity level of the solver. | |
| unsigned long long const & | accessCount () const |
| Number of kernel accesses. | |
| void | setMinAccuracy (double a) |
| void | setMaxIterations (unsigned long long i) |
| void | setTargetValue (double v) |
| void | setMaxSeconds (double s) |
Public Member Functions inherited from shark::IParameterizable< VectorType > | |
| virtual | ~IParameterizable () |
Public Attributes | |
| QpStoppingCondition | m_stoppingcondition |
| conditions for when to stop the QP solver | |
| QpSolutionProperties | m_solutionproperties |
| properties of the approximate solution found by the solver | |
| unsigned int | m_verbosity |
| verbosity level (currently unused) | |
Protected Attributes | |
| double | m_C |
| Regularization parameter. The exact meaning depends on the sub-class, but the value is always positive, and higher implies a less regular solution. | |
| bool | m_trainOffset |
| Is the SVM trained with or without bias? | |
| bool | m_unconstrained |
| Is log(C) stored internally as a parameter instead of C? If yes, then we get rid of the constraint C > 0 on the level of the parameter interface. | |
Protected Attributes inherited from shark::QpConfig | |
| QpStoppingCondition | m_stoppingcondition |
| conditions for when to stop the QP solver | |
| QpSolutionProperties | m_solutionproperties |
| properties of the approximate solution found by the solver | |
| bool | m_precomputedKernelMatrix |
| should the solver use a precomputed kernel matrix? | |
| bool | m_sparsify |
| should the trainer sparsify the model after training? | |
| bool | m_shrinking |
| should shrinking be used? | |
| bool | m_s2do |
| should S2DO be used instead of SMO? | |
| unsigned int | m_verbosity |
| verbosity level (currently unused) | |
| unsigned long long | m_accessCount |
| kernel access count | |
Super class of all linear SVM trainers.
Definition at line 320 of file AbstractSvmTrainer.h.
| typedef LinearClassifier<InputType> shark::AbstractLinearSvmTrainer< InputType >::ModelType |
Definition at line 327 of file AbstractSvmTrainer.h.
|
inline |
Constructor
| C | regularization parameter - always the 'true' value of C, even when unconstrained is set |
| offset | train svm with offset - this is not supported for all SVM solvers. |
| unconstrained | when a C-value is given via setParameter, should it be piped through the exp-function before using it in the solver? |
Definition at line 333 of file AbstractSvmTrainer.h.
References shark::AbstractLinearSvmTrainer< InputType >::C(), and SHARK_RUNTIME_CHECK.
|
inline |
Return the value of the regularization parameter C.
Definition at line 340 of file AbstractSvmTrainer.h.
References shark::AbstractLinearSvmTrainer< InputType >::m_C.
Referenced by shark::AbstractLinearSvmTrainer< InputType >::AbstractLinearSvmTrainer(), shark::AbstractLinearSvmTrainer< InputType >::setC(), and shark::SquaredHingeLinearCSvmTrainer< InputType >::train().
|
inline |
Is the regularization parameter provided in logarithmic (unconstrained) form as a parameter?
Definition at line 350 of file AbstractSvmTrainer.h.
References shark::AbstractLinearSvmTrainer< InputType >::m_unconstrained.
|
inlinevirtual |
Return the number of hyper-parameters.
Reimplemented from shark::IParameterizable< VectorType >.
Definition at line 372 of file AbstractSvmTrainer.h.
|
inlinevirtual |
Get the hyper-parameter vector.
Reimplemented from shark::IParameterizable< VectorType >.
Definition at line 357 of file AbstractSvmTrainer.h.
References shark::AbstractLinearSvmTrainer< InputType >::m_C, and shark::AbstractLinearSvmTrainer< InputType >::m_unconstrained.
|
inline |
Set the value of the regularization parameter C.
Definition at line 344 of file AbstractSvmTrainer.h.
References shark::AbstractLinearSvmTrainer< InputType >::C(), shark::AbstractLinearSvmTrainer< InputType >::m_C, and SHARK_RUNTIME_CHECK.
Referenced by shark::AbstractLinearSvmTrainer< InputType >::setParameterVector().
|
inlinevirtual |
Set the vector of hyper-parameters.
Reimplemented from shark::IParameterizable< VectorType >.
Definition at line 365 of file AbstractSvmTrainer.h.
References shark::AbstractLinearSvmTrainer< InputType >::m_unconstrained, shark::AbstractLinearSvmTrainer< InputType >::setC(), and SHARK_ASSERT.
|
inline |
Definition at line 353 of file AbstractSvmTrainer.h.
References shark::AbstractLinearSvmTrainer< InputType >::m_trainOffset.
|
protected |
Regularization parameter. The exact meaning depends on the sub-class, but the value is always positive, and higher implies a less regular solution.
Definition at line 380 of file AbstractSvmTrainer.h.
Referenced by shark::AbstractLinearSvmTrainer< InputType >::C(), shark::AbstractLinearSvmTrainer< InputType >::parameterVector(), and shark::AbstractLinearSvmTrainer< InputType >::setC().
| QpSolutionProperties shark::QpConfig::m_solutionproperties |
properties of the approximate solution found by the solver
Definition at line 153 of file AbstractSvmTrainer.h.
| QpStoppingCondition shark::QpConfig::m_stoppingcondition |
conditions for when to stop the QP solver
Definition at line 151 of file AbstractSvmTrainer.h.
|
protected |
Is the SVM trained with or without bias?
Definition at line 381 of file AbstractSvmTrainer.h.
Referenced by shark::AbstractLinearSvmTrainer< InputType >::trainOffset().
|
protected |
Is log(C) stored internally as a parameter instead of C? If yes, then we get rid of the constraint C > 0 on the level of the parameter interface.
Definition at line 382 of file AbstractSvmTrainer.h.
Referenced by shark::AbstractLinearSvmTrainer< InputType >::isUnconstrained(), shark::AbstractLinearSvmTrainer< InputType >::parameterVector(), and shark::AbstractLinearSvmTrainer< InputType >::setParameterVector().
| unsigned int shark::QpConfig::m_verbosity |
verbosity level (currently unused)
Definition at line 163 of file AbstractSvmTrainer.h.