93 jubatus::util::lang::shared_ptr<unlearner::unlearner_base>
unlearner;
94 shared_ptr<classifier_base> res;
95 if (name ==
"perceptron") {
97 if (param.type() != jubatus::util::text::json::json::Null) {
98 unlearner_config conf = config_cast_check<unlearner_config>(param);
101 res.reset(
new perceptron(storage));
102 }
else if (name ==
"PA" || name ==
"passive_aggressive") {
104 if (param.type() != jubatus::util::text::json::json::Null) {
105 unlearner_config conf = config_cast_check<unlearner_config>(param);
108 res.reset(
new passive_aggressive(storage));
109 }
else if (name ==
"PA1" || name ==
"passive_aggressive_1") {
110 if (param.type() == jubatus::util::text::json::json::Null) {
113 "parameter block is not specified in config"));
115 unlearning_classifier_config conf
116 = config_cast_check<unlearning_classifier_config>(param);
118 res.reset(
new passive_aggressive_1(conf, storage));
119 }
else if (name ==
"PA2" || name ==
"passive_aggressive_2") {
120 if (param.type() == jubatus::util::text::json::json::Null) {
123 "parameter block is not specified in config"));
125 unlearning_classifier_config conf
126 = config_cast_check<unlearning_classifier_config>(param);
128 res.reset(
new passive_aggressive_2(conf, storage));
129 }
else if (name ==
"CW" || name ==
"confidence_weighted") {
130 if (param.type() == jubatus::util::text::json::json::Null) {
133 "parameter block is not specified in config"));
135 unlearning_classifier_config conf
136 = config_cast_check<unlearning_classifier_config>(param);
138 res.reset(
new confidence_weighted(conf, storage));
139 }
else if (name ==
"AROW" || name ==
"arow") {
140 if (param.type() == jubatus::util::text::json::json::Null) {
143 "parameter block is not specified in config"));
145 unlearning_classifier_config conf
146 = config_cast_check<unlearning_classifier_config>(param);
148 res.reset(
new arow(conf, storage));
149 }
else if (name ==
"NHERD" || name ==
"normal_herd") {
150 if (param.type() == jubatus::util::text::json::json::Null) {
153 "parameter block is not specified in config"));
155 unlearning_classifier_config conf
156 = config_cast_check<unlearning_classifier_config>(param);
158 res.reset(
new normal_herd(conf, storage));
159 }
else if (name ==
"NN" || name ==
"nearest_neighbor") {
160 if (param.type() == jubatus::util::text::json::json::Null) {
163 "parameter block is not specified in config"));
165 nearest_neighbor_classifier_config conf
166 = config_cast_check<nearest_neighbor_classifier_config>(param);
168 shared_ptr<storage::column_table> table(
new storage::column_table);
169 shared_ptr<nearest_neighbor::nearest_neighbor_base>
171 conf.method, conf.parameter, table,
""));
173 new nearest_neighbor_classifier(nearest_neighbor_engine,
174 conf.nearest_neighbor_num,
175 conf.local_sensitivity));
178 common::unsupported_method(
"classifier(" + name +
")"));
182 res->set_label_unlearner(unlearner);
shared_ptr< unlearner_base > create_unlearner(const std::string &name, const common::jsonconfig::config &config)
jubatus::util::data::optional< std::string > unlearner
#define JUBATUS_EXCEPTION(e)
error_info< struct error_message_, std::string > error_message
shared_ptr< nearest_neighbor_base > create_nearest_neighbor(const std::string &name, const common::jsonconfig::config &config, shared_ptr< storage::column_table > table, const std::string &id)