jubatus_core
0.1.2
Jubatus: Online machine learning framework for distributed environment
|
#include <lof_storage.hpp>
Classes | |
struct | config |
Public Member Functions | |
void | clear () |
float | collect_lrds (const common::sfv_t &query, jubatus::util::data::unordered_map< std::string, float > &neighbor_lrd) const |
float | collect_lrds (const std::string &id, jubatus::util::data::unordered_map< std::string, float > &neighbor_lrd) const |
void | get_all_row_ids (std::vector< std::string > &ids) const |
void | get_diff (lof_table_t &diff) const |
float | get_kdist (const std::string &row) const |
float | get_lrd (const std::string &row) const |
storage::version | get_version () const |
bool | has_row (const std::string &row) const |
lof_storage () | |
lof_storage (jubatus::util::lang::shared_ptr< core::recommender::recommender_base > nn_engine) | |
lof_storage (const config &config, jubatus::util::lang::shared_ptr< core::recommender::recommender_base > nn_engine) | |
void | mix (const lof_table_t &lhs, lof_table_t &rhs) const |
MSGPACK_DEFINE (lof_table_, lof_table_diff_, neighbor_num_, reverse_nn_num_) | |
std::string | name () const |
void | pack (framework::packer &packer) const |
bool | put_diff (const lof_table_t &mixed_diff) |
void | remove_row (const std::string &row) |
void | set_nn_engine (jubatus::util::lang::shared_ptr< core::recommender::recommender_base > nn_engine) |
void | unpack (msgpack::object o) |
void | update_all () |
void | update_row (const std::string &row, const common::sfv_t &diff) |
virtual | ~lof_storage () |
Static Public Attributes | |
static const uint32_t | DEFAULT_NEIGHBOR_NUM = 10 |
static const uint32_t | DEFAULT_REVERSE_NN_NUM = 30 |
Private Member Functions | |
float | collect_lrds_from_neighbors (const std::vector< std::pair< std::string, float > > &neighbors, jubatus::util::data::unordered_map< std::string, float > &neighbor_lrd) const |
void | collect_neighbors (const std::string &row, jubatus::util::data::unordered_set< std::string > &nn) const |
void | update_entries (const jubatus::util::data::unordered_set< std::string > &rows) |
void | update_kdist (const std::string &row) |
void | update_kdist_with_neighbors (const std::string &row, const std::vector< std::pair< std::string, float > > &neighbors) |
void | update_lrd (const std::string &row) |
void | update_lrd_with_neighbors (const std::string &row, const std::vector< std::pair< std::string, float > > &neighbors) |
Static Private Member Functions | |
static bool | is_removed (const lof_entry &entry) |
static void | mark_removed (lof_entry &entry) |
Private Attributes | |
lof_table_t | lof_table_ |
lof_table_t | lof_table_diff_ |
uint32_t | neighbor_num_ |
jubatus::util::lang::shared_ptr< core::recommender::recommender_base > | nn_engine_ |
uint32_t | reverse_nn_num_ |
Definition at line 52 of file lof_storage.hpp.
jubatus::core::anomaly::lof_storage::lof_storage | ( | ) |
Definition at line 59 of file lof_storage.cpp.
|
explicit |
|
explicit |
|
virtual |
Definition at line 83 of file lof_storage.cpp.
void jubatus::core::anomaly::lof_storage::clear | ( | ) |
Definition at line 125 of file lof_storage.cpp.
References lof_table_, lof_table_diff_, and nn_engine_.
float jubatus::core::anomaly::lof_storage::collect_lrds | ( | const common::sfv_t & | query, |
jubatus::util::data::unordered_map< std::string, float > & | neighbor_lrd | ||
) | const |
float jubatus::core::anomaly::lof_storage::collect_lrds | ( | const std::string & | id, |
jubatus::util::data::unordered_map< std::string, float > & | neighbor_lrd | ||
) | const |
|
private |
Based on the given neighbors (list of ID and the distance to it), get the LRDs for each neighbor points and return the calculated LRD for the point. neighbors
donesn't have to be sorted.
Definition at line 260 of file lof_storage.cpp.
References get_kdist(), and get_lrd().
|
private |
Collect neighbors for the given ID.
Definition at line 290 of file lof_storage.cpp.
References nn_engine_, and reverse_nn_num_.
Referenced by update_row().
void jubatus::core::anomaly::lof_storage::get_all_row_ids | ( | std::vector< std::string > & | ids | ) | const |
Definition at line 131 of file lof_storage.cpp.
References nn_engine_.
Referenced by update_all().
void jubatus::core::anomaly::lof_storage::get_diff | ( | lof_table_t & | diff | ) | const |
Definition at line 215 of file lof_storage.cpp.
References lof_table_diff_.
float jubatus::core::anomaly::lof_storage::get_kdist | ( | const std::string & | row | ) | const |
Definition at line 158 of file lof_storage.cpp.
References is_removed(), JUBATUS_EXCEPTION, lof_table_, and lof_table_diff_.
Referenced by collect_lrds_from_neighbors(), and update_lrd_with_neighbors().
float jubatus::core::anomaly::lof_storage::get_lrd | ( | const std::string & | row | ) | const |
Definition at line 175 of file lof_storage.cpp.
References is_removed(), JUBATUS_EXCEPTION, lof_table_, and lof_table_diff_.
Referenced by collect_lrds_from_neighbors().
|
inline |
Definition at line 120 of file lof_storage.hpp.
bool jubatus::core::anomaly::lof_storage::has_row | ( | const std::string & | row | ) | const |
Definition at line 192 of file lof_storage.cpp.
References lof_table_, and lof_table_diff_.
|
staticprivate |
Definition at line 250 of file lof_storage.cpp.
References jubatus::core::anomaly::lof_entry::kdist.
Referenced by get_kdist(), get_lrd(), mix(), and put_diff().
|
staticprivate |
Definition at line 245 of file lof_storage.cpp.
References jubatus::core::anomaly::lof_entry::kdist.
Referenced by mix(), and remove_row().
void jubatus::core::anomaly::lof_storage::mix | ( | const lof_table_t & | lhs, |
lof_table_t & | rhs | ||
) | const |
Definition at line 232 of file lof_storage.cpp.
References is_removed(), and mark_removed().
jubatus::core::anomaly::lof_storage::MSGPACK_DEFINE | ( | lof_table_ | , |
lof_table_diff_ | , | ||
neighbor_num_ | , | ||
reverse_nn_num_ | |||
) |
string jubatus::core::anomaly::lof_storage::name | ( | ) | const |
Definition at line 154 of file lof_storage.cpp.
|
inline |
Definition at line 124 of file lof_storage.hpp.
bool jubatus::core::anomaly::lof_storage::put_diff | ( | const lof_table_t & | mixed_diff | ) |
Definition at line 219 of file lof_storage.cpp.
References is_removed(), lof_table_, and lof_table_diff_.
void jubatus::core::anomaly::lof_storage::remove_row | ( | const std::string & | row | ) |
Definition at line 120 of file lof_storage.cpp.
References lof_table_diff_, mark_removed(), and nn_engine_.
void jubatus::core::anomaly::lof_storage::set_nn_engine | ( | jubatus::util::lang::shared_ptr< core::recommender::recommender_base > | nn_engine | ) |
Definition at line 210 of file lof_storage.cpp.
References nn_engine_.
|
inline |
Definition at line 127 of file lof_storage.hpp.
void jubatus::core::anomaly::lof_storage::update_all | ( | ) |
Definition at line 196 of file lof_storage.cpp.
References get_all_row_ids(), update_kdist(), and update_lrd().
|
private |
Update kdist and LRD for given points and its neighbors.
Definition at line 304 of file lof_storage.cpp.
References neighbor_num_, nn_engine_, update_kdist_with_neighbors(), and update_lrd_with_neighbors().
Referenced by update_row().
|
private |
Update kdist for the row.
Definition at line 329 of file lof_storage.cpp.
References neighbor_num_, nn_engine_, and update_kdist_with_neighbors().
Referenced by update_all().
|
private |
Update kdist for the row using given NN search result (neighbors
). Note that this method expects neighbors
to be sorted by score.
Definition at line 339 of file lof_storage.cpp.
References lof_table_diff_.
Referenced by update_entries(), and update_kdist().
|
private |
Update LRD for the row.
Definition at line 350 of file lof_storage.cpp.
References neighbor_num_, nn_engine_, and update_lrd_with_neighbors().
Referenced by update_all().
|
private |
Update LRD for the row using given NN search result (neighbors
).
Definition at line 359 of file lof_storage.cpp.
References get_kdist(), lof_table_diff_, and neighbor_num_.
Referenced by update_entries(), and update_lrd().
void jubatus::core::anomaly::lof_storage::update_row | ( | const std::string & | row, |
const common::sfv_t & | diff | ||
) |
Definition at line 135 of file lof_storage.cpp.
References collect_neighbors(), nn_engine_, and update_entries().
|
static |
Definition at line 54 of file lof_storage.hpp.
|
static |
Definition at line 55 of file lof_storage.hpp.
|
private |
Definition at line 158 of file lof_storage.hpp.
Referenced by clear(), get_kdist(), get_lrd(), has_row(), and put_diff().
|
private |
Definition at line 159 of file lof_storage.hpp.
Referenced by clear(), get_diff(), get_kdist(), get_lrd(), has_row(), put_diff(), remove_row(), update_kdist_with_neighbors(), and update_lrd_with_neighbors().
|
private |
Definition at line 161 of file lof_storage.hpp.
Referenced by update_entries(), update_kdist(), update_lrd(), and update_lrd_with_neighbors().
|
private |
Definition at line 165 of file lof_storage.hpp.
Referenced by clear(), collect_neighbors(), get_all_row_ids(), remove_row(), set_nn_engine(), update_entries(), update_kdist(), update_lrd(), and update_row().
|
private |
Definition at line 162 of file lof_storage.hpp.
Referenced by collect_neighbors().