jubatus_core  0.1.2
Jubatus: Online machine learning framework for distributed environment
anomaly.hpp
Go to the documentation of this file.
1 // Jubatus: Online machine learning framework for distributed environment
2 // Copyright (C) 2011,2012 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_DRIVER_ANOMALY_HPP_
18 #define JUBATUS_CORE_DRIVER_ANOMALY_HPP_
19 
20 #include <string>
21 #include <utility>
22 #include <vector>
23 
24 #include "jubatus/util/lang/shared_ptr.h"
25 #include "../fv_converter/mixable_weight_manager.hpp"
26 #include "driver.hpp"
27 
28 namespace jubatus {
29 namespace core {
30 namespace fv_converter {
31 class datum;
33 } // namespace fv_converter
34 namespace anomaly {
35 class anomaly_base;
36 } // namespace anomaly
37 namespace driver {
38 
39 class anomaly : public driver_base {
40  public:
41  anomaly(
42  jubatus::util::lang::shared_ptr<core::anomaly::anomaly_base>
43  anomaly_method,
44  jubatus::util::lang::shared_ptr<fv_converter::datum_to_fv_converter>
45  converter);
46  virtual ~anomaly();
47 
49  return anomaly_.get();
50  }
51 
52  bool is_updatable() const;
53 
54  void clear_row(const std::string& id);
55  std::pair<std::string, float> add(
56  const std::string& id,
57  const fv_converter::datum& d);
58  float update(const std::string& id, const fv_converter::datum& d);
59  float overwrite(const std::string& id, const fv_converter::datum& d);
60  void clear();
61  void pack(framework::packer& pk) const;
62  void unpack(msgpack::object o);
63  float calc_score(const fv_converter::datum& d) const;
64  std::vector<std::string> get_all_rows() const;
65  uint64_t find_max_int_id() const;
66 
67  private:
68  jubatus::util::lang::shared_ptr<fv_converter::datum_to_fv_converter>
70  jubatus::util::lang::shared_ptr<core::anomaly::anomaly_base> anomaly_;
72 };
73 
74 } // namespace driver
75 } // namespace core
76 } // namespace jubatus
77 
78 #endif // JUBATUS_CORE_DRIVER_ANOMALY_HPP_
fv_converter::mixable_weight_manager wm_
Definition: anomaly.hpp:71
void unpack(msgpack::object o)
Definition: anomaly.cpp:122
jubatus::util::lang::shared_ptr< fv_converter::datum_to_fv_converter > converter_
Definition: anomaly.hpp:69
float calc_score(const fv_converter::datum &d) const
Definition: anomaly.cpp:100
jubatus::core::anomaly::anomaly_base * get_model() const
Definition: anomaly.hpp:48
jubatus::util::lang::shared_ptr< core::anomaly::anomaly_base > anomaly_
Definition: anomaly.hpp:70
uint64_t find_max_int_id() const
Definition: anomaly.cpp:112
std::pair< std::string, float > add(const std::string &id, const fv_converter::datum &d)
Definition: anomaly.cpp:69
float overwrite(const std::string &id, const fv_converter::datum &d)
Definition: anomaly.cpp:87
anomaly(jubatus::util::lang::shared_ptr< core::anomaly::anomaly_base > anomaly_method, jubatus::util::lang::shared_ptr< fv_converter::datum_to_fv_converter > converter)
Definition: anomaly.cpp:43
void clear_row(const std::string &id)
Definition: anomaly.cpp:65
void pack(framework::packer &pk) const
Definition: anomaly.cpp:116
std::vector< std::string > get_all_rows() const
Definition: anomaly.cpp:106
float update(const std::string &id, const fv_converter::datum &d)
Definition: anomaly.cpp:79