25 namespace classifier {
34 string incorrect_label;
35 float margin =
calc_margin(sfv, label, incorrect_label);
36 float loss = 1.f + margin;
41 if (sfv_norm == 0.f) {
45 update_weight(sfv, loss / (2 * sfv_norm), label, incorrect_label);
50 return string(
"passive_aggressive");
jubatus::util::lang::shared_ptr< jubatus::core::storage::storage_base > storage_ptr
static float squared_norm(const common::sfv_t &sfv)
void train(const common::sfv_t &fv, const std::string &label)
passive_aggressive(storage_ptr storage)
void check_touchable(const std::string &label)
std::vector< std::pair< std::string, float > > sfv_t
void touch(const std::string &label)
float calc_margin(const common::sfv_t &sfv, const std::string &label, std::string &incorrect_label) const
void update_weight(const common::sfv_t &sfv, float step_weigth, const std::string &pos_label, const std::string &neg_class)