jubatus_core  0.1.2
Jubatus: Online machine learning framework for distributed environment
regression_base.hpp
Go to the documentation of this file.
1 // Jubatus: Online machine learning framework for distributed environment
2 // Copyright (C) 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_REGRESSION_REGRESSION_BASE_HPP_
18 #define JUBATUS_CORE_REGRESSION_REGRESSION_BASE_HPP_
19 
20 #include <map>
21 #include <string>
22 #include "jubatus/util/lang/shared_ptr.h"
23 #include "../common/type.hpp"
24 #include "../framework/linear_function_mixer.hpp"
25 
26 namespace jubatus {
27 namespace core {
28 
29 namespace storage {
30 class storage_base;
31 } // namespace storage
32 
33 namespace regression {
34 
36  public:
37  explicit regression_base(storage_ptr storage);
38 
39  virtual ~regression_base() {
40  }
41 
42  virtual void train(const common::sfv_t& fv, const float value) = 0;
43  float estimate(const common::sfv_t& fv) const;
44 
45  virtual void clear();
46 
47  // TODO(beam2d): Think the objective of this function and where it should be
48  // defined. Algorithms have |get_status| tentatively to extract status from
49  // storages.
50  virtual void get_status(std::map<std::string, std::string>& status) const;
51 
53 
54  protected:
55  void update(const common::sfv_t& fv, float coeff);
56 
58 };
59 
60 } // namespace regression
61 
62 } // namespace core
63 } // namespace jubatus
64 
65 #endif // JUBATUS_CORE_REGRESSION_REGRESSION_BASE_HPP_
jubatus::util::lang::shared_ptr< jubatus::core::storage::storage_base > storage_ptr
virtual void get_status(std::map< std::string, std::string > &status) const
float estimate(const common::sfv_t &fv) const
void update(const common::sfv_t &fv, float coeff)
virtual void train(const common::sfv_t &fv, const float value)=0
std::vector< std::pair< std::string, float > > sfv_t
Definition: type.hpp:29