23 #include "jubatus/util/concurrent/lock.h"
25 #include "../common/exception.hpp"
31 namespace classifier {
52 string incorrect_label;
62 float alpha = (1.f - margin) * beta;
63 update(sfv, alpha, beta, label, incorrect_label);
70 const std::string& pos_label,
71 const std::string& neg_label) {
72 util::concurrent::scoped_lock lk(
storage_->get_lock());
73 for (common::sfv_t::const_iterator it = sfv.begin(); it != sfv.end(); ++it) {
74 const string& feature = it->first;
75 float val = it->second;
87 pos_val.
v1 + alpha * pos_val.
v2 * val,
88 pos_val.
v2 - beta * pos_val.
v2 * pos_val.
v2 * val * val));
89 if (neg_label !=
"") {
94 neg_val.
v1 - alpha * neg_val.
v2 * val,
95 neg_val.
v2 - beta * neg_val.
v2 * neg_val.
v2 * val * val));
102 return string(
"arow");
jubatus::util::lang::shared_ptr< jubatus::core::storage::storage_base > storage_ptr
static void get_two(const T &t, const std::string &label1, const std::string &label2, U &u1, U &u2)
arow(storage_ptr storage)
float calc_margin_and_variance(const common::sfv_t &sfv, const std::string &label, std::string &incorrect_label, float &variance) const
void train(const common::sfv_t &fv, const std::string &label)
#define JUBATUS_EXCEPTION(e)
void update(const common::sfv_t &fv, float alpha, float beta, const std::string &pos_label, const std::string &neg_label)
void check_touchable(const std::string &label)
classifier_config config_
std::vector< std::pair< std::string, float > > sfv_t
void touch(const std::string &label)
std::vector< std::pair< std::string, val2_t > > feature_val2_t
float regularization_weight