jubatus_core  0.1.2
Jubatus: Online machine learning framework for distributed environment
classifier_base.hpp
Go to the documentation of this file.
1 // Jubatus: Online machine learning framework for distributed environment
2 // Copyright (C) 2011 Preferred Networks and Nippon Telegraph and Telephone Corporation.
3 //
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License version 2.1 as published by the Free Software Foundation.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16 
17 #ifndef JUBATUS_CORE_CLASSIFIER_CLASSIFIER_BASE_HPP_
18 #define JUBATUS_CORE_CLASSIFIER_CLASSIFIER_BASE_HPP_
19 
20 #include <stdint.h>
21 
22 #include <map>
23 #include <string>
24 #include <vector>
25 
26 #include "../common/type.hpp"
27 #include "../framework/packer.hpp"
28 #include "../framework/mixable.hpp"
29 #include "../unlearner/unlearner_base.hpp"
30 #include "classifier_type.hpp"
31 
32 namespace jubatus {
33 namespace core {
34 namespace classifier {
35 
37  public:
39  }
40  virtual ~classifier_base() {
41  }
42 
43  virtual void train(const common::sfv_t& fv, const std::string& label) = 0;
44 
45  virtual void classify_with_scores(
46  const common::sfv_t& fv, classify_result& scores) const = 0;
47 
48  virtual void set_label_unlearner(
49  jubatus::util::lang::shared_ptr<unlearner::unlearner_base>
50  label_unlearner) = 0;
51 
52  virtual bool delete_label(const std::string& label) = 0;
53  virtual std::vector<std::string> get_labels() const = 0;
54  virtual bool set_label(const std::string& label) = 0;
55 
56  virtual std::string name() const = 0;
57 
58  virtual void get_status(std::map<std::string, std::string>& status) const = 0;
59 
60  virtual void pack(framework::packer& pk) const = 0;
61  virtual void unpack(msgpack::object o) = 0;
62  virtual void clear() = 0;
63 
64  virtual framework::mixable* get_mixable() = 0;
65 };
66 
67 } // namespace classifier
68 } // namespace core
69 } // namespace jubatus
70 
71 #endif // JUBATUS_CORE_CLASSIFIER_CLASSIFIER_BASE_HPP_
std::vector< classify_result_elem > classify_result
virtual framework::mixable * get_mixable()=0
virtual std::vector< std::string > get_labels() const =0
virtual void set_label_unlearner(jubatus::util::lang::shared_ptr< unlearner::unlearner_base > label_unlearner)=0
virtual bool set_label(const std::string &label)=0
virtual void train(const common::sfv_t &fv, const std::string &label)=0
virtual void classify_with_scores(const common::sfv_t &fv, classify_result &scores) const =0
virtual bool delete_label(const std::string &label)=0
virtual void unpack(msgpack::object o)=0
std::vector< std::pair< std::string, float > > sfv_t
Definition: type.hpp:29
virtual std::string name() const =0
virtual void pack(framework::packer &pk) const =0
virtual void get_status(std::map< std::string, std::string > &status) const =0