jubatus_core  0.1.2
Jubatus: Online machine learning framework for distributed environment
regression.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_REGRESSION_HPP_
18 #define JUBATUS_CORE_DRIVER_REGRESSION_HPP_
19 
20 #include <map>
21 #include <string>
22 #include <utility>
23 
24 #include "jubatus/util/lang/shared_ptr.h"
25 #include "../framework/linear_function_mixer.hpp"
26 #include "../fv_converter/mixable_weight_manager.hpp"
27 #include "driver.hpp"
28 
29 namespace jubatus {
30 namespace core {
31 namespace fv_converter {
32 class datum;
33 class datum_to_fv_converter;
34 } // namespace fv_converter
35 namespace regression {
36 class regression_base;
37 } // namespace regression
38 namespace driver {
39 
40 class regression : public driver_base {
41  public:
43  regression(
44  jubatus::util::lang::shared_ptr<storage::storage_base>
45  model_storage,
46  jubatus::util::lang::shared_ptr<regression_base>
47  regression_method,
48  jubatus::util::lang::shared_ptr<fv_converter::datum_to_fv_converter>
49  converter);
50  virtual ~regression();
51 
52  void train(const std::pair<float, fv_converter::datum>& data);
53  float estimate(const fv_converter::datum& data) const;
54 
55  void get_status(std::map<std::string, std::string>& status) const;
56  void clear();
57 
58  void pack(framework::packer& pk) const;
59  void unpack(msgpack::object o);
60 
61  private:
62  jubatus::util::lang::shared_ptr<fv_converter::datum_to_fv_converter>
64  jubatus::util::lang::shared_ptr<jubatus::core::regression::regression_base>
68 };
69 
70 } // namespace driver
71 } // namespace core
72 } // namespace jubatus
73 
74 #endif // JUBATUS_CORE_DRIVER_REGRESSION_HPP_
jubatus::util::lang::shared_ptr< jubatus::core::regression::regression_base > regression_
Definition: regression.hpp:65
float estimate(const fv_converter::datum &data) const
Definition: regression.cpp:62
void train(const std::pair< float, fv_converter::datum > &data)
Definition: regression.cpp:56
fv_converter::mixable_weight_manager wm_
Definition: regression.hpp:67
regression(jubatus::util::lang::shared_ptr< storage::storage_base > model_storage, jubatus::util::lang::shared_ptr< regression_base > regression_method, jubatus::util::lang::shared_ptr< fv_converter::datum_to_fv_converter > converter)
Definition: regression.cpp:39
void pack(framework::packer &pk) const
Definition: regression.cpp:79
void get_status(std::map< std::string, std::string > &status) const
Definition: regression.cpp:70
void unpack(msgpack::object o)
Definition: regression.cpp:85
core::regression::regression_base regression_base
Definition: regression.hpp:42
framework::linear_function_mixer mixable_regression_model_
Definition: regression.hpp:66
jubatus::util::lang::shared_ptr< fv_converter::datum_to_fv_converter > converter_
Definition: regression.hpp:63