17 #ifndef JUBATUS_CORE_CLASSIFIER_LINEAR_CLASSIFIER_HPP_
18 #define JUBATUS_CORE_CLASSIFIER_LINEAR_CLASSIFIER_HPP_
27 #include "../common/type.hpp"
28 #include "../framework/linear_function_mixer.hpp"
29 #include "../storage/storage_base.hpp"
30 #include "../unlearner/unlearner_base.hpp"
36 namespace classifier {
45 jubatus::util::lang::shared_ptr<unlearner::unlearner_base>
48 jubatus::util::lang::shared_ptr<unlearner::unlearner_base>
63 virtual std::string
name()
const = 0;
68 virtual void get_status(std::map<std::string, std::string>& status)
const;
71 void unpack(msgpack::object o);
79 const std::string& pos_label,
80 const std::string& neg_class);
83 const std::string& label,
84 std::string& incorrect_label)
const;
87 const std::string& label,
88 std::string& incorrect_label,
89 float& variance)
const;
92 const std::string& label,
97 void touch(
const std::string& label);
100 jubatus::util::lang::shared_ptr<unlearner::unlearner_base>
unlearner_;
108 #endif // JUBATUS_CORE_CLASSIFIER_LINEAR_CLASSIFIER_HPP_
jubatus::util::lang::shared_ptr< jubatus::core::storage::storage_base > storage_ptr
std::vector< classify_result_elem > classify_result
virtual std::string name() const =0
bool set_label(const std::string &label)
static float squared_norm(const common::sfv_t &sfv)
bool unlearn_label(const std::string &label)
void classify_with_scores(const common::sfv_t &fv, classify_result &scores) const
void set_label_unlearner(jubatus::util::lang::shared_ptr< unlearner::unlearner_base > label_unlearner)
void unpack(msgpack::object o)
jubatus::util::lang::shared_ptr< unlearner::unlearner_base > label_unlearner() const
float calc_margin_and_variance(const common::sfv_t &sfv, const std::string &label, std::string &incorrect_label, float &variance) const
virtual ~linear_classifier()
void check_touchable(const std::string &label)
framework::mixable * get_mixable()
jubatus::util::lang::shared_ptr< unlearner::unlearner_base > unlearner_
void pack(framework::packer &pk) const
virtual void train(const common::sfv_t &fv, const std::string &label)=0
std::string classify(const common::sfv_t &fv) const
std::vector< std::string > get_labels() const
framework::linear_function_mixer mixable_storage_
linear_classifier(storage_ptr storage)
std::vector< std::pair< std::string, float > > sfv_t
virtual void get_status(std::map< std::string, std::string > &status) const
void touch(const std::string &label)
std::string get_largest_incorrect_label(const common::sfv_t &sfv, const std::string &label, classify_result &scores) const
bool delete_label(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)