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

#include <anomaly.hpp>

Inheritance diagram for jubatus::core::driver::anomaly:
Inheritance graph
Collaboration diagram for jubatus::core::driver::anomaly:
Collaboration graph

Public Member Functions

std::pair< std::string, float > add (const std::string &id, const fv_converter::datum &d)
 
 anomaly (jubatus::util::lang::shared_ptr< core::anomaly::anomaly_base > anomaly_method, jubatus::util::lang::shared_ptr< fv_converter::datum_to_fv_converter > converter)
 
float calc_score (const fv_converter::datum &d) const
 
void clear ()
 
void clear_row (const std::string &id)
 
uint64_t find_max_int_id () const
 
std::vector< std::string > get_all_rows () const
 
jubatus::core::anomaly::anomaly_baseget_model () const
 
bool is_updatable () const
 
float overwrite (const std::string &id, const fv_converter::datum &d)
 
void pack (framework::packer &pk) const
 
void unpack (msgpack::object o)
 
float update (const std::string &id, const fv_converter::datum &d)
 
virtual ~anomaly ()
 
- Public Member Functions inherited from jubatus::core::driver::driver_base
 driver_base ()
 
virtual framework::mixableget_mixable ()
 
std::vector< storage::versionget_versions () const
 
virtual ~driver_base ()
 

Private Attributes

jubatus::util::lang::shared_ptr< core::anomaly::anomaly_baseanomaly_
 
jubatus::util::lang::shared_ptr< fv_converter::datum_to_fv_converterconverter_
 
fv_converter::mixable_weight_manager wm_
 

Additional Inherited Members

- Protected Member Functions inherited from jubatus::core::driver::driver_base
void register_mixable (framework::mixable *mixable)
 
- Protected Attributes inherited from jubatus::core::driver::driver_base
mixable_holder holder_
 

Detailed Description

Definition at line 39 of file anomaly.hpp.

Constructor & Destructor Documentation

jubatus::core::driver::anomaly::anomaly ( jubatus::util::lang::shared_ptr< core::anomaly::anomaly_base anomaly_method,
jubatus::util::lang::shared_ptr< fv_converter::datum_to_fv_converter converter 
)

Definition at line 43 of file anomaly.cpp.

References anomaly_, converter_, jubatus::core::framework::linear_mixable_helper< Model, Diff >::get_model(), jubatus::core::driver::driver_base::register_mixable(), and wm_.

46  : converter_(converter),
47  anomaly_(anomaly_method),
49  vector<framework::mixable*> mixables = anomaly_->get_mixables();
50  for (size_t i = 0; i < mixables.size(); i++) {
51  register_mixable(mixables[i]);
52  }
54 
55  converter_->set_weight_manager(wm_.get_model());
56 }
fv_converter::mixable_weight_manager wm_
Definition: anomaly.hpp:71
jubatus::util::lang::shared_ptr< fv_converter::datum_to_fv_converter > converter_
Definition: anomaly.hpp:69
jubatus::util::lang::shared_ptr< core::anomaly::anomaly_base > anomaly_
Definition: anomaly.hpp:70
void register_mixable(framework::mixable *mixable)
Definition: driver.cpp:242
storage::mixable_lsh_index_storage::model_ptr model_ptr
Definition: euclid_lsh.cpp:90

Here is the call graph for this function:

jubatus::core::driver::anomaly::~anomaly ( )
virtual

Definition at line 58 of file anomaly.cpp.

58  {
59 }

Member Function Documentation

pair< string, float > jubatus::core::driver::anomaly::add ( const std::string &  id,
const fv_converter::datum d 
)

Definition at line 69 of file anomaly.cpp.

References anomaly_, overwrite(), and update().

71  {
72  if (anomaly_->is_updatable()) {
73  return make_pair(id, this->update(id, d));
74  } else {
75  return make_pair(id, this->overwrite(id, d));
76  }
77 }
jubatus::util::lang::shared_ptr< core::anomaly::anomaly_base > anomaly_
Definition: anomaly.hpp:70
float overwrite(const std::string &id, const fv_converter::datum &d)
Definition: anomaly.cpp:87
float update(const std::string &id, const fv_converter::datum &d)
Definition: anomaly.cpp:79

Here is the call graph for this function:

float jubatus::core::driver::anomaly::calc_score ( const fv_converter::datum d) const

Definition at line 100 of file anomaly.cpp.

References anomaly_, converter_, and jubatus::core::common::jsonconfig::v().

100  {
102  converter_->convert(d, v);
103  return anomaly_->calc_anomaly_score(v);
104 }
jubatus::util::lang::shared_ptr< fv_converter::datum_to_fv_converter > converter_
Definition: anomaly.hpp:69
jubatus::util::lang::shared_ptr< core::anomaly::anomaly_base > anomaly_
Definition: anomaly.hpp:70
std::vector< T > v(size)
std::vector< std::pair< std::string, float > > sfv_t
Definition: type.hpp:29

Here is the call graph for this function:

void jubatus::core::driver::anomaly::clear ( )
virtual

Implements jubatus::core::driver::driver_base.

Definition at line 95 of file anomaly.cpp.

References anomaly_, and converter_.

95  {
96  anomaly_->clear();
97  converter_->clear_weights();
98 }
jubatus::util::lang::shared_ptr< fv_converter::datum_to_fv_converter > converter_
Definition: anomaly.hpp:69
jubatus::util::lang::shared_ptr< core::anomaly::anomaly_base > anomaly_
Definition: anomaly.hpp:70
void jubatus::core::driver::anomaly::clear_row ( const std::string &  id)

Definition at line 65 of file anomaly.cpp.

References anomaly_.

65  {
66  anomaly_->clear_row(id);
67 }
jubatus::util::lang::shared_ptr< core::anomaly::anomaly_base > anomaly_
Definition: anomaly.hpp:70
uint64_t jubatus::core::driver::anomaly::find_max_int_id ( ) const

Definition at line 112 of file anomaly.cpp.

References anomaly_.

112  {
113  return anomaly_->find_max_int_id();
114 }
jubatus::util::lang::shared_ptr< core::anomaly::anomaly_base > anomaly_
Definition: anomaly.hpp:70
vector< string > jubatus::core::driver::anomaly::get_all_rows ( ) const

Definition at line 106 of file anomaly.cpp.

References anomaly_.

106  {
107  vector<string> ids;
108  anomaly_->get_all_row_ids(ids);
109  return ids;
110 }
jubatus::util::lang::shared_ptr< core::anomaly::anomaly_base > anomaly_
Definition: anomaly.hpp:70
jubatus::core::anomaly::anomaly_base* jubatus::core::driver::anomaly::get_model ( ) const
inline

Definition at line 48 of file anomaly.hpp.

References anomaly_.

48  {
49  return anomaly_.get();
50  }
jubatus::util::lang::shared_ptr< core::anomaly::anomaly_base > anomaly_
Definition: anomaly.hpp:70
bool jubatus::core::driver::anomaly::is_updatable ( ) const

Definition at line 61 of file anomaly.cpp.

References anomaly_.

61  {
62  return anomaly_->is_updatable();
63 }
jubatus::util::lang::shared_ptr< core::anomaly::anomaly_base > anomaly_
Definition: anomaly.hpp:70
float jubatus::core::driver::anomaly::overwrite ( const std::string &  id,
const fv_converter::datum d 
)

Definition at line 87 of file anomaly.cpp.

References anomaly_, converter_, and jubatus::core::common::jsonconfig::v().

Referenced by add().

87  {
89  converter_->convert_and_update_weight(d, v);
90 
91  anomaly_->set_row(id, v);
92  return anomaly_->calc_anomaly_score(id);
93 }
jubatus::util::lang::shared_ptr< fv_converter::datum_to_fv_converter > converter_
Definition: anomaly.hpp:69
jubatus::util::lang::shared_ptr< core::anomaly::anomaly_base > anomaly_
Definition: anomaly.hpp:70
std::vector< T > v(size)
std::vector< std::pair< std::string, float > > sfv_t
Definition: type.hpp:29

Here is the call graph for this function:

Here is the caller graph for this function:

void jubatus::core::driver::anomaly::pack ( framework::packer pk) const
virtual

Implements jubatus::core::driver::driver_base.

Definition at line 116 of file anomaly.cpp.

References anomaly_, jubatus::core::framework::linear_mixable_helper< Model, Diff >::get_model(), and wm_.

116  {
117  pk.pack_array(2);
118  anomaly_->pack(pk);
119  wm_.get_model()->pack(pk);
120 }
fv_converter::mixable_weight_manager wm_
Definition: anomaly.hpp:71
jubatus::util::lang::shared_ptr< core::anomaly::anomaly_base > anomaly_
Definition: anomaly.hpp:70

Here is the call graph for this function:

void jubatus::core::driver::anomaly::unpack ( msgpack::object  o)
virtual

Implements jubatus::core::driver::driver_base.

Definition at line 122 of file anomaly.cpp.

References anomaly_, converter_, jubatus::core::framework::linear_mixable_helper< Model, Diff >::get_model(), and wm_.

122  {
123  if (o.type != msgpack::type::ARRAY || o.via.array.size != 2) {
124  throw msgpack::type_error();
125  }
126 
127  // clear before load
128  anomaly_->clear();
129  converter_->clear_weights();
130  anomaly_->unpack(o.via.array.ptr[0]);
131  wm_.get_model()->unpack(o.via.array.ptr[1]);
132 }
fv_converter::mixable_weight_manager wm_
Definition: anomaly.hpp:71
jubatus::util::lang::shared_ptr< fv_converter::datum_to_fv_converter > converter_
Definition: anomaly.hpp:69
jubatus::util::lang::shared_ptr< core::anomaly::anomaly_base > anomaly_
Definition: anomaly.hpp:70

Here is the call graph for this function:

float jubatus::core::driver::anomaly::update ( const std::string &  id,
const fv_converter::datum d 
)

Definition at line 79 of file anomaly.cpp.

References anomaly_, converter_, and jubatus::core::common::jsonconfig::v().

Referenced by add().

79  {
81  converter_->convert_and_update_weight(d, v);
82 
83  anomaly_->update_row(id, v);
84  return anomaly_->calc_anomaly_score(id);
85 }
jubatus::util::lang::shared_ptr< fv_converter::datum_to_fv_converter > converter_
Definition: anomaly.hpp:69
jubatus::util::lang::shared_ptr< core::anomaly::anomaly_base > anomaly_
Definition: anomaly.hpp:70
std::vector< T > v(size)
std::vector< std::pair< std::string, float > > sfv_t
Definition: type.hpp:29

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

jubatus::util::lang::shared_ptr<core::anomaly::anomaly_base> jubatus::core::driver::anomaly::anomaly_
private
jubatus::util::lang::shared_ptr<fv_converter::datum_to_fv_converter> jubatus::core::driver::anomaly::converter_
private

Definition at line 69 of file anomaly.hpp.

Referenced by anomaly(), calc_score(), clear(), overwrite(), unpack(), and update().

fv_converter::mixable_weight_manager jubatus::core::driver::anomaly::wm_
private

Definition at line 71 of file anomaly.hpp.

Referenced by anomaly(), pack(), and unpack().


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