jubatus_core  0.1.2
Jubatus: Online machine learning framework for distributed environment
regression_base.cpp
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 #include "regression_base.hpp"
18 
19 #include <map>
20 #include <string>
21 #include "../storage/storage_base.hpp"
22 
23 namespace jubatus {
24 namespace core {
25 namespace regression {
26 
28  : storage_(storage) {
29 }
30 
31 float regression_base::estimate(const common::sfv_t& fv) const {
33  storage_->inp(fv, ret);
34  return ret["+"];
35 }
36 
37 void regression_base::update(const common::sfv_t& fv, float coeff) {
38  storage_->bulk_update(fv, coeff, "+", "");
39 }
40 
42  storage_->clear();
43 }
44 
45 void regression_base::get_status(std::map<std::string, std::string>& status)
46  const {
47  storage_->get_status(status);
48  status["storage"] = storage_->type();
49 }
50 
52  return storage_;
53 }
54 
55 } // namespace regression
56 } // namespace core
57 } // namespace jubatus
jubatus::util::lang::shared_ptr< jubatus::core::storage::storage_base > storage_ptr
virtual void get_status(std::map< std::string, std::string > &status) const
jubatus::util::data::unordered_map< std::string, val1_t > map_feature_val1_t
float estimate(const common::sfv_t &fv) const
void update(const common::sfv_t &fv, float coeff)
std::vector< std::pair< std::string, float > > sfv_t
Definition: type.hpp:29