17 #ifndef JUBATUS_CORE_CLASSIFIER_NEAREST_NEIGHBOR_CLASSIFIER_HPP_
18 #define JUBATUS_CORE_CLASSIFIER_NEAREST_NEIGHBOR_CLASSIFIER_HPP_
25 #include "jubatus/util/math/random.h"
26 #include "jubatus/util/data/unordered_set.h"
27 #include "jubatus/util/concurrent/lock.h"
28 #include "jubatus/util/concurrent/mutex.h"
30 #include "../common/type.hpp"
31 #include "../nearest_neighbor/nearest_neighbor_base.hpp"
32 #include "../unlearner/unlearner_base.hpp"
38 namespace classifier {
43 jubatus::util::lang::shared_ptr<nearest_neighbor::nearest_neighbor_base>
44 nearest_neighbor_engine,
45 size_t k,
float alpha);
50 jubatus::util::lang::shared_ptr<unlearner::unlearner_base>
62 std::string
name()
const;
64 void get_status(std::map<std::string, std::string>& status)
const;
67 void unpack(msgpack::object o);
72 jubatus::util::lang::shared_ptr<nearest_neighbor::nearest_neighbor_base>
74 jubatus::util::data::unordered_set<std::string>
labels_;
78 jubatus::util::lang::shared_ptr<unlearner::unlearner_base>
unlearner_;
80 jubatus::util::math::random::mtrand
rand_;
90 #endif // JUBATUS_CORE_CLASSIFIER_NEAREST_NEIGHBOR_CLASSIFIER_HPP_
jubatus::util::concurrent::mutex unlearner_mutex_
std::vector< classify_result_elem > classify_result
jubatus::util::lang::shared_ptr< unlearner::unlearner_base > unlearner_
nearest_neighbor_classifier(jubatus::util::lang::shared_ptr< nearest_neighbor::nearest_neighbor_base > nearest_neighbor_engine, size_t k, float alpha)
bool set_label(const std::string &label)
jubatus::util::math::random::mtrand rand_
std::vector< std::string > get_labels() const
void get_status(std::map< std::string, std::string > &status) const
bool delete_label(const std::string &label)
void train(const common::sfv_t &fv, const std::string &label)
void pack(framework::packer &pk) const
void unpack(msgpack::object o)
jubatus::util::concurrent::mutex rand_mutex_
framework::mixable * get_mixable()
void set_label_unlearner(jubatus::util::lang::shared_ptr< unlearner::unlearner_base > label_unlearner)
jubatus::util::data::unordered_set< std::string > labels_
void classify_with_scores(const common::sfv_t &fv, classify_result &scores) const
std::vector< std::pair< std::string, float > > sfv_t
std::string classify(const common::sfv_t &fv) const
void unlearn_id(const std::string &id)
jubatus::util::lang::shared_ptr< nearest_neighbor::nearest_neighbor_base > nearest_neighbor_engine_