IRI ROS Specific Driver Class. More...
#include <svmsgd_alg.h>
Public Types | |
typedef iri_svmsgd::SvmsgdConfig | Config |
define config type | |
Public Member Functions | |
void | config_update (Config &new_cfg, uint32_t level=0) |
config update | |
float | get_bias () |
std::vector< float > | get_w () |
void | lock (void) |
Lock Algorithm. | |
void | process_new_example (std::vector< float > &new_example, double label) |
SvmsgdAlgorithm (void) | |
constructor | |
bool | try_enter (void) |
Tries Access to Algorithm. | |
void | unlock (void) |
Unlock Algorithm. | |
~SvmsgdAlgorithm (void) | |
Destructor. | |
Public Attributes | |
Config | config_ |
config variable | |
Protected Member Functions | |
void | add_to_dense_vec (const std::vector< float > &vec1, double alpha, double *vec2) |
void | add_to_dense_vec_abs (const std::vector< float > &vec1, double alpha, double *vec2) |
double | dloss (double z) |
double | dot (const std::vector< float > &v1, const double *v2, int n) |
double | loss (double z) |
Protected Attributes | |
CMutex | alg_mutex_ |
define config type | |
double | bias |
double | bscale |
bool | calibrated |
int | count |
int | d |
double | lambda |
int | loss_type |
int | num_iters |
int | skip |
double | t |
int | use_bias |
int | use_reg_bias |
double * | w |
double | wscale |
IRI ROS Specific Driver Class.
Definition at line 51 of file svmsgd_alg.h.
typedef iri_svmsgd::SvmsgdConfig SvmsgdAlgorithm::Config |
define config type
Define a Config type with the SvmsgdConfig. All driver implementations will then use the same variable type Config.
Definition at line 110 of file svmsgd_alg.h.
SvmsgdAlgorithm::SvmsgdAlgorithm | ( | void | ) |
constructor
In this constructor parameters related to the specific driver can be initalized. Those parameters can be also set in the openDriver() function. Attributes from the main node driver class IriBaseDriver such as loop_rate, may be also overload here.
Definition at line 3 of file svmsgd_alg.cpp.
SvmsgdAlgorithm::~SvmsgdAlgorithm | ( | void | ) |
Destructor.
This destructor is called when the object is about to be destroyed.
Definition at line 24 of file svmsgd_alg.cpp.
void SvmsgdAlgorithm::add_to_dense_vec | ( | const std::vector< float > & | vec1, |
double | alpha, | ||
double * | vec2 | ||
) | [inline, protected] |
Definition at line 79 of file svmsgd_alg.h.
void SvmsgdAlgorithm::add_to_dense_vec_abs | ( | const std::vector< float > & | vec1, |
double | alpha, | ||
double * | vec2 | ||
) | [inline, protected] |
Definition at line 85 of file svmsgd_alg.h.
void SvmsgdAlgorithm::config_update | ( | Config & | new_cfg, |
uint32_t | level = 0 |
||
) |
config update
In this function the driver parameters must be updated with the input config variable. Then the new configuration state will be stored in the Config attribute.
new_cfg | the new driver configuration state |
level | level in which the update is taken place |
Definition at line 29 of file svmsgd_alg.cpp.
double SvmsgdAlgorithm::dloss | ( | double | z | ) | [protected] |
Definition at line 39 of file svmsgd_alg.cpp.
double SvmsgdAlgorithm::dot | ( | const std::vector< float > & | v1, |
const double * | v2, | ||
int | n | ||
) | [inline, protected] |
Definition at line 91 of file svmsgd_alg.h.
float SvmsgdAlgorithm::get_bias | ( | ) | [inline] |
Definition at line 178 of file svmsgd_alg.h.
std::vector<float> SvmsgdAlgorithm::get_w | ( | ) | [inline] |
Definition at line 179 of file svmsgd_alg.h.
void SvmsgdAlgorithm::lock | ( | void | ) | [inline] |
double SvmsgdAlgorithm::loss | ( | double | z | ) | [protected] |
Definition at line 66 of file svmsgd_alg.cpp.
void SvmsgdAlgorithm::process_new_example | ( | std::vector< float > & | new_example, |
double | label | ||
) |
Definition at line 148 of file svmsgd_alg.cpp.
bool SvmsgdAlgorithm::try_enter | ( | void | ) | [inline] |
Tries Access to Algorithm.
Tries access to Algorithm
Definition at line 151 of file svmsgd_alg.h.
void SvmsgdAlgorithm::unlock | ( | void | ) | [inline] |
Unlock Algorithm.
Unlocks access to the Algorithm class
Definition at line 142 of file svmsgd_alg.h.
CMutex SvmsgdAlgorithm::alg_mutex_ [protected] |
define config type
Define a Config type with the SvmsgdConfig. All driver implementations will then use the same variable type Config.
Definition at line 60 of file svmsgd_alg.h.
double SvmsgdAlgorithm::bias [protected] |
Definition at line 67 of file svmsgd_alg.h.
double SvmsgdAlgorithm::bscale [protected] |
Definition at line 72 of file svmsgd_alg.h.
bool SvmsgdAlgorithm::calibrated [protected] |
Definition at line 77 of file svmsgd_alg.h.
config variable
This variable has all the driver parameters defined in the cfg config file. Is updated everytime function config_update() is called.
Definition at line 118 of file svmsgd_alg.h.
int SvmsgdAlgorithm::count [protected] |
Definition at line 73 of file svmsgd_alg.h.
int SvmsgdAlgorithm::d [protected] |
Definition at line 65 of file svmsgd_alg.h.
double SvmsgdAlgorithm::lambda [protected] |
Definition at line 69 of file svmsgd_alg.h.
int SvmsgdAlgorithm::loss_type [protected] |
Definition at line 64 of file svmsgd_alg.h.
int SvmsgdAlgorithm::num_iters [protected] |
Definition at line 63 of file svmsgd_alg.h.
int SvmsgdAlgorithm::skip [protected] |
Definition at line 74 of file svmsgd_alg.h.
double SvmsgdAlgorithm::t [protected] |
Definition at line 75 of file svmsgd_alg.h.
int SvmsgdAlgorithm::use_bias [protected] |
Definition at line 70 of file svmsgd_alg.h.
int SvmsgdAlgorithm::use_reg_bias [protected] |
Definition at line 71 of file svmsgd_alg.h.
double* SvmsgdAlgorithm::w [protected] |
Definition at line 66 of file svmsgd_alg.h.
double SvmsgdAlgorithm::wscale [protected] |
Definition at line 76 of file svmsgd_alg.h.