jubatus_core  0.1.2
Jubatus: Online machine learning framework for distributed environment
Static Public Member Functions | List of all members
jubatus::core::bandit::bandit_factory Class Reference

#include <bandit_factory.hpp>

Collaboration diagram for jubatus::core::bandit::bandit_factory:
Collaboration graph

Static Public Member Functions

static jubatus::util::lang::shared_ptr< bandit_basecreate (const std::string &name, const common::jsonconfig::config &param)
 

Detailed Description

Definition at line 32 of file bandit_factory.hpp.

Member Function Documentation

shared_ptr< bandit_base > jubatus::core::bandit::bandit_factory::create ( const std::string &  name,
const common::jsonconfig::config param 
)
static

Definition at line 73 of file bandit_factory.cpp.

References jubatus::core::bandit::epsilon_greedy_config::assume_unrewarded, jubatus::core::bandit::ucb1_config::assume_unrewarded, jubatus::core::bandit::softmax_config::assume_unrewarded, jubatus::core::bandit::exp3_config::assume_unrewarded, jubatus::core::bandit::epsilon_greedy_config::epsilon, jubatus::core::bandit::exp3_config::gamma, JUBATUS_EXCEPTION, jubatus::core::bandit::softmax_config::tau, and jubatus::core::common::jsonconfig::config::type().

75  {
76  if (name == "epsilon_greedy") {
77  if (param.type() == json::json::Null) {
78  throw JUBATUS_EXCEPTION(
79  common::config_exception() << common::exception::error_message(
80  "parameter block is not specified in config"));
81  }
82  epsilon_greedy_config conf =
83  config_cast_check<epsilon_greedy_config>(param);
84  return shared_ptr<bandit_base>(
85  new epsilon_greedy(conf.assume_unrewarded, conf.epsilon));
86  } else if (name == "ucb1") {
87  if (param.type() == json::json::Null) {
88  throw JUBATUS_EXCEPTION(
89  common::config_exception() << common::exception::error_message(
90  "parameter block is not specified in config"));
91  }
92  ucb1_config conf =
93  config_cast_check<ucb1_config>(param);
94  return shared_ptr<bandit_base>(new ucb1(conf.assume_unrewarded));
95  } else if (name == "softmax") {
96  if (param.type() == json::json::Null) {
97  throw JUBATUS_EXCEPTION(
98  common::config_exception() << common::exception::error_message(
99  "parameter block is not specified in config"));
100  }
101  softmax_config conf = config_cast_check<softmax_config>(param);
102  return shared_ptr<bandit_base>(
103  new softmax(conf.assume_unrewarded, conf.tau));
104  } else if (name == "exp3") {
105  if (param.type() == json::json::Null) {
106  throw JUBATUS_EXCEPTION(
107  common::config_exception() << common::exception::error_message(
108  "parameter block is not specified in config"));
109  }
110  exp3_config conf = config_cast_check<exp3_config>(param);
111  return shared_ptr<bandit_base>(
112  new exp3(conf.assume_unrewarded, conf.gamma));
113  } else {
114  throw JUBATUS_EXCEPTION(
115  common::unsupported_method("bandit(" + name + ")"));
116  }
117 }
#define JUBATUS_EXCEPTION(e)
Definition: exception.hpp:79
error_info< struct error_message_, std::string > error_message
Definition: exception.hpp:59

Here is the call graph for this function:


The documentation for this class was generated from the following files: