Feat C++ API
A feature engineering automation tool
shogun::CMyMulticlassLibLinear Class Reference

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>

Inheritance diagram for shogun::CMyMulticlassLibLinear:
Collaboration diagram for shogun::CMyMulticlassLibLinear:

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 ()
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ CMyMulticlassLibLinear() [1/2]

shogun::CMyMulticlassLibLinear::CMyMulticlassLibLinear ( )

default constructor

Definition at line 15 of file MyMulticlassLibLinear.cc.

◆ CMyMulticlassLibLinear() [2/2]

shogun::CMyMulticlassLibLinear::CMyMulticlassLibLinear ( float64_t  C,
CDotFeatures *  features,
CLabels *  labs 
)

standard constructor

Parameters
CC regularization constant value
featuresfeatures
labslabels

Definition at line 26 of file MyMulticlassLibLinear.cc.

◆ ~CMyMulticlassLibLinear()

shogun::CMyMulticlassLibLinear::~CMyMulticlassLibLinear ( )

destructor

Definition at line 36 of file MyMulticlassLibLinear.cc.

Member Function Documentation

◆ get_C()

float64_t shogun::CMyMulticlassLibLinear::get_C ( ) const
inline

get C

Returns
C value

Definition at line 61 of file MyMulticlassLibLinear.cc.

◆ get_epsilon()

float64_t shogun::CMyMulticlassLibLinear::get_epsilon ( ) const
inline

get epsilon

Returns
epsilon value

Definition at line 75 of file MyMulticlassLibLinear.cc.

◆ get_max_iter()

int32_t shogun::CMyMulticlassLibLinear::get_max_iter ( ) const
inline

get max iter

Returns
max iter value

Definition at line 121 of file MyMulticlassLibLinear.cc.

◆ get_name()

const char * shogun::CMyMulticlassLibLinear::get_name ( ) const
virtual

get name

Definition at line 44 of file MyMulticlassLibLinear.cc.

◆ get_save_train_state()

bool shogun::CMyMulticlassLibLinear::get_save_train_state ( ) const
inline

get save train state

Returns
save_train_state value

Definition at line 104 of file MyMulticlassLibLinear.cc.

◆ get_support_vectors()

SGVector< int32_t > shogun::CMyMulticlassLibLinear::get_support_vectors ( ) const

get support vector indices

Returns
support vector indices

Definition at line 136 of file MyMulticlassLibLinear.cc.

◆ get_use_bias()

bool shogun::CMyMulticlassLibLinear::get_use_bias ( ) const
inline

get use bias

Returns
use_bias value

Definition at line 88 of file MyMulticlassLibLinear.cc.

◆ get_w()

vector< SGVector< float64_t > > shogun::CMyMulticlassLibLinear::get_w ( ) const

Definition at line 168 of file MyMulticlassLibLinear.cc.

◆ init_defaults()

void shogun::CMyMulticlassLibLinear::init_defaults ( )
private

Definition at line 266 of file MyMulticlassLibLinear.cc.

◆ MACHINE_PROBLEM_TYPE()

shogun::CMyMulticlassLibLinear::MACHINE_PROBLEM_TYPE ( PT_MULTICLASS  )

◆ obtain_regularizer_matrix()

SGMatrix< float64_t > shogun::CMyMulticlassLibLinear::obtain_regularizer_matrix ( ) const
protected

obtain regularizer (w0) matrix

Definition at line 261 of file MyMulticlassLibLinear.cc.

◆ register_parameters()

void shogun::CMyMulticlassLibLinear::register_parameters ( )
private

Definition at line 276 of file MyMulticlassLibLinear.cc.

◆ reset_train_state()

void shogun::CMyMulticlassLibLinear::reset_train_state ( )

reset train state

Definition at line 124 of file MyMulticlassLibLinear.cc.

◆ set_C()

void shogun::CMyMulticlassLibLinear::set_C ( float64_t  C)
inline

set C

Parameters
CC value

Definition at line 52 of file MyMulticlassLibLinear.cc.

◆ set_epsilon()

void shogun::CMyMulticlassLibLinear::set_epsilon ( float64_t  epsilon)
inline

set epsilon

Parameters
epsilonepsilon value

Definition at line 66 of file MyMulticlassLibLinear.cc.

◆ set_max_iter()

void shogun::CMyMulticlassLibLinear::set_max_iter ( int32_t  max_iter)
inline

set max iter

Parameters
max_itermax iter value

Definition at line 112 of file MyMulticlassLibLinear.cc.

◆ set_save_train_state()

void shogun::CMyMulticlassLibLinear::set_save_train_state ( bool  save_train_state)
inline

set save train state

Parameters
save_train_statesave train state value

Definition at line 96 of file MyMulticlassLibLinear.cc.

◆ set_use_bias()

void shogun::CMyMulticlassLibLinear::set_use_bias ( bool  use_bias)
inline

set use bias

Parameters
use_biasuse_bias value

Definition at line 80 of file MyMulticlassLibLinear.cc.

◆ set_w()

void shogun::CMyMulticlassLibLinear::set_w ( vector< Eigen::VectorXd >  wnew)

Definition at line 183 of file MyMulticlassLibLinear.cc.

◆ train_machine()

bool shogun::CMyMulticlassLibLinear::train_machine ( CFeatures *  data)
protected

train machine

Definition at line 196 of file MyMulticlassLibLinear.cc.

Member Data Documentation

◆ m_C

float64_t shogun::CMyMulticlassLibLinear::m_C
protected

regularization constant for each machine

Definition at line 147 of file MyMulticlassLibLinear.h.

◆ m_epsilon

float64_t shogun::CMyMulticlassLibLinear::m_epsilon
protected

tolerance

Definition at line 150 of file MyMulticlassLibLinear.h.

◆ m_max_iter

int32_t shogun::CMyMulticlassLibLinear::m_max_iter
protected

max number of iterations

Definition at line 153 of file MyMulticlassLibLinear.h.

◆ m_save_train_state

bool shogun::CMyMulticlassLibLinear::m_save_train_state
protected

save train state

Definition at line 159 of file MyMulticlassLibLinear.h.

◆ m_train_state

mcsvm_state* shogun::CMyMulticlassLibLinear::m_train_state
protected

solver state

Definition at line 162 of file MyMulticlassLibLinear.h.

◆ m_use_bias

bool shogun::CMyMulticlassLibLinear::m_use_bias
protected

use bias

Definition at line 156 of file MyMulticlassLibLinear.h.


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