jubatus_core  0.1.2
Jubatus: Online machine learning framework for distributed environment
regression_factory.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_factory.hpp"
18 
19 #include <stdexcept>
20 #include <string>
21 
22 #include "regression.hpp"
23 #include "../common/exception.hpp"
24 #include "../common/jsonconfig.hpp"
25 
27 using jubatus::util::lang::shared_ptr;
28 
29 namespace jubatus {
30 namespace core {
31 namespace regression {
32 
33 shared_ptr<regression_base> regression_factory::create_regression(
34  const std::string& name,
35  const common::jsonconfig::config& param,
36  shared_ptr<storage::storage_base> storage) {
37  if (name == "PA" || name == "passive_aggressive") {
38  return shared_ptr<regression_base>(new regression::passive_aggressive(
39  config_cast_check<regression::passive_aggressive::config>(param),
40  storage));
41  } else {
43  }
44 }
45 
46 } // namespace regression
47 } // namespace core
48 } // namespace jubatus
T config_cast_check(const config &c)
Definition: cast.hpp:311
#define JUBATUS_EXCEPTION(e)
Definition: exception.hpp:79
static jubatus::util::lang::shared_ptr< regression_base > create_regression(const std::string &name, const common::jsonconfig::config &param, jubatus::util::lang::shared_ptr< storage::storage_base > storage)