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

#include <anomaly_factory.hpp>

Collaboration diagram for jubatus::core::anomaly::anomaly_factory:
Collaboration graph

Static Public Member Functions

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

Detailed Description

Definition at line 37 of file anomaly_factory.hpp.

Member Function Documentation

shared_ptr< anomaly_base > jubatus::core::anomaly::anomaly_factory::create_anomaly ( const std::string &  name,
const common::jsonconfig::config param,
const std::string &  id 
)
static

Definition at line 75 of file anomaly_factory.cpp.

References jubatus::core::nearest_neighbor::create_nearest_neighbor(), jubatus::core::recommender::recommender_factory::create_recommender(), jubatus::core::unlearner::create_unlearner(), JUBATUS_EXCEPTION, and unlearner.

78  {
79  if (name == "lof") {
80  lof_config conf = config_cast_check<lof_config>(param);
81 
82  return shared_ptr<anomaly_base>(new lof(
83  conf,
85  conf.method,
86  conf.parameter, id)));
87  } else if (name == "light_lof") {
88  light_lof_config conf = config_cast_check<light_lof_config>(param);
89 
90  jubatus::util::lang::shared_ptr<storage::column_table>
91  nearest_neighbor_table(new storage::column_table);
92  jubatus::util::lang::shared_ptr<nearest_neighbor::nearest_neighbor_base>
93  nearest_neighbor_engine(nearest_neighbor::create_nearest_neighbor(
94  conf.method, conf.parameter, nearest_neighbor_table, id));
95 
96  if (conf.unlearner) {
97  if (!conf.unlearner_parameter) {
98  throw JUBATUS_EXCEPTION(
99  common::config_exception()
101  "unlearner is set but unlearner_parameter is not found"));
102  }
103  jubatus::util::lang::shared_ptr<unlearner::unlearner_base> unlearner(
105  *conf.unlearner,
106  *conf.unlearner_parameter));
107  return shared_ptr<anomaly_base>(
108  new light_lof(conf, id, nearest_neighbor_engine, unlearner));
109  }
110 
111  return jubatus::util::lang::shared_ptr<anomaly_base>(
112  new light_lof(conf, id, nearest_neighbor_engine));
113  } else {
114  throw JUBATUS_EXCEPTION(common::unsupported_method(name));
115  }
116 };
static jubatus::util::lang::shared_ptr< recommender_base > create_recommender(const std::string &name, const common::jsonconfig::config &param, const std::string &id)
shared_ptr< unlearner_base > create_unlearner(const std::string &name, const common::jsonconfig::config &config)
#define JUBATUS_EXCEPTION(e)
Definition: exception.hpp:79
jubatus::util::data::optional< std::string > unlearner
error_info< struct error_message_, std::string > error_message
Definition: exception.hpp:59
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)

Here is the call graph for this function:


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