Feat C++ API
A feature engineering automation tool
|
multiclass LibLinear wrapper. Uses Crammer-Singer formulation and gradient descent optimization algorithm implemented in the LibLinear library. Regularized bias support is added using stacking bias 'feature' to hyperplanes normal vectors. More...
#include <MyMulticlassLibLinear.h>
Public Member Functions | |
MACHINE_PROBLEM_TYPE (PT_MULTICLASS) | |
CMyMulticlassLibLinear () | |
CMyMulticlassLibLinear (float64_t C, CDotFeatures *features, CLabels *labs) | |
~CMyMulticlassLibLinear () | |
virtual const char * | get_name () const |
void | set_C (float64_t C) |
float64_t | get_C () const |
void | set_epsilon (float64_t epsilon) |
float64_t | get_epsilon () const |
void | set_use_bias (bool use_bias) |
bool | get_use_bias () const |
void | set_save_train_state (bool save_train_state) |
bool | get_save_train_state () const |
void | set_max_iter (int32_t max_iter) |
int32_t | get_max_iter () const |
void | reset_train_state () |
SGVector< int32_t > | get_support_vectors () const |
vector< SGVector< float64_t > > | get_w () const |
void | set_w (vector< Eigen::VectorXd > wnew) |
Protected Member Functions | |
bool | train_machine (CFeatures *data) |
SGMatrix< float64_t > | obtain_regularizer_matrix () const |
Protected Attributes | |
float64_t | m_C |
float64_t | m_epsilon |
int32_t | m_max_iter |
bool | m_use_bias |
bool | m_save_train_state |
mcsvm_state * | m_train_state |
Private Member Functions | |
void | init_defaults () |
void | register_parameters () |
multiclass LibLinear wrapper. Uses Crammer-Singer formulation and gradient descent optimization algorithm implemented in the LibLinear library. Regularized bias support is added using stacking bias 'feature' to hyperplanes normal vectors.
In case of small changes of C or particularly epsilon this class provides ability to save whole liblinear training state (i.e. W vector, gradients, etc) and re-use on next train() calls. This capability could be enabled using set_save_train_state() method. Train state can be forced to clear using reset_train_state() method.
Definition at line 44 of file MyMulticlassLibLinear.h.
shogun::CMyMulticlassLibLinear::CMyMulticlassLibLinear | ( | ) |
default constructor
Definition at line 15 of file MyMulticlassLibLinear.cc.
shogun::CMyMulticlassLibLinear::CMyMulticlassLibLinear | ( | float64_t | C, |
CDotFeatures * | features, | ||
CLabels * | labs | ||
) |
standard constructor
C | C regularization constant value |
features | features |
labs | labels |
Definition at line 26 of file MyMulticlassLibLinear.cc.
shogun::CMyMulticlassLibLinear::~CMyMulticlassLibLinear | ( | ) |
destructor
Definition at line 36 of file MyMulticlassLibLinear.cc.
|
inline |
|
inline |
|
inline |
|
virtual |
get name
Definition at line 44 of file MyMulticlassLibLinear.cc.
|
inline |
get save train state
Definition at line 104 of file MyMulticlassLibLinear.cc.
SGVector< int32_t > shogun::CMyMulticlassLibLinear::get_support_vectors | ( | ) | const |
get support vector indices
Definition at line 136 of file MyMulticlassLibLinear.cc.
|
inline |
vector< SGVector< float64_t > > shogun::CMyMulticlassLibLinear::get_w | ( | ) | const |
Definition at line 168 of file MyMulticlassLibLinear.cc.
|
private |
Definition at line 266 of file MyMulticlassLibLinear.cc.
shogun::CMyMulticlassLibLinear::MACHINE_PROBLEM_TYPE | ( | PT_MULTICLASS | ) |
|
protected |
obtain regularizer (w0) matrix
Definition at line 261 of file MyMulticlassLibLinear.cc.
|
private |
Definition at line 276 of file MyMulticlassLibLinear.cc.
void shogun::CMyMulticlassLibLinear::reset_train_state | ( | ) |
reset train state
Definition at line 124 of file MyMulticlassLibLinear.cc.
|
inline |
|
inline |
|
inline |
set max iter
max_iter | max iter value |
Definition at line 112 of file MyMulticlassLibLinear.cc.
|
inline |
set save train state
save_train_state | save train state value |
Definition at line 96 of file MyMulticlassLibLinear.cc.
|
inline |
set use bias
use_bias | use_bias value |
Definition at line 80 of file MyMulticlassLibLinear.cc.
void shogun::CMyMulticlassLibLinear::set_w | ( | vector< Eigen::VectorXd > | wnew | ) |
Definition at line 183 of file MyMulticlassLibLinear.cc.
|
protected |
train machine
Definition at line 196 of file MyMulticlassLibLinear.cc.
|
protected |
regularization constant for each machine
Definition at line 147 of file MyMulticlassLibLinear.h.
|
protected |
tolerance
Definition at line 150 of file MyMulticlassLibLinear.h.
|
protected |
max number of iterations
Definition at line 153 of file MyMulticlassLibLinear.h.
|
protected |
save train state
Definition at line 159 of file MyMulticlassLibLinear.h.
|
protected |
solver state
Definition at line 162 of file MyMulticlassLibLinear.h.
|
protected |
use bias
Definition at line 156 of file MyMulticlassLibLinear.h.