#include <hazy_sgd.h>
Inheritance diagram for Hazy_Sgd< T >:
Public Member Functions | |
Hazy_Sgd (Storage_Manager< T > *sm, IncrementalSGD< T > *sgd, Skiing &ski, hazy_model::strategy s) | |
Constructor for Hazy that uses default model and requires Storage Manager. | |
void | updateModel (T vec, sClass label) |
Updates model with given example and updates external results accordingly. | |
void | deleteModel (std::string db_name, std::string table_name) |
void | readEntityClass (key entity_id, sClass &c) |
Gets entity id and gives class of entity. | |
void | readEntityClass (T vec, sClass &label) |
Gets feature vector of the entity and gives class of the entity. | |
void | readEntityClass (T vec, double eps, sClass &label) |
Gets feature vector and eps of the entity and gives class of the entity. | |
void | readNumInClass (sClass c, int &nClass) |
Gives the # of entities that belong to the given class c. | |
Protected Types | |
typedef std::map< std::string, Hazy_Database * > | _connection_map |
Protected Member Functions | |
void | updateModel () |
According to the strategy, updates storage manager. | |
void | holder_difference_models (double &delta_w, double &delta_b) |
Calculates differences between models. | |
void | update_low_high_water () |
Calculates low & high water values. | |
Protected Attributes | |
int | _dim |
Skiing | ski |
Skiing object that maintains low & high water, acc cost and resort cost. | |
IncrementalSGD< T > * | sgd |
Sgd model which is maintained. | |
hazy_model | hm |
Keeps track of the hazy model Kept up-to-date by SGD code (so needs to be initialized after) Also contains the low and high water values. | |
Storage_Manager< T > * | st_man |
Storage manager object that updates related storages for entities. | |
pthread_rwlock_t | _rwlock |
Fine-grained read-write lock. | |
model | _last_sort_model |
The model that the entities are clustered on. | |
_connection_map | connections |
bool | _high_low_water_valid |
LAZY_HAZY flags if (_high_low_water_valid) then the high and the low water in the model are valid the model will become invalidated on a lazy_hazy update. |
typedef std::map<std::string, Hazy_Database*> Hazy_Sgd< T >::_connection_map [protected] |
Hazy_Sgd< T >::Hazy_Sgd | ( | Storage_Manager< T > * | sm, | |
IncrementalSGD< T > * | sgd, | |||
Skiing & | ski, | |||
hazy_model::strategy | s | |||
) |
Constructor for Hazy that uses default model and requires Storage Manager.
[in] | sm | storage manager used in hazy sgd |
[in] | sgd | sgd model |
[in] | ski | skiing object that contains information about skiing strategy |
[in] | s | strategy which is either LAZY_NAIVE, LAZY_HAZY, EAGER_NAIVE, EAGER_HAZY |
void Hazy_Sgd< T >::deleteModel | ( | std::string | db_name, | |
std::string | table_name | |||
) |
void Hazy_Sgd< T >::holder_difference_models | ( | double & | delta_w, | |
double & | delta_b | |||
) | [protected] |
Calculates differences between models.
[out] | delta_w | the difference between feature vector of the model from last sort and feature vector of the current model |
[out] | delta_b | the difference between bias of the model from last sort and bias of the current model |
Gets feature vector and eps of the entity and gives class of the entity.
Used for lazy hazy reads on on-disk
[in] | vec | feature vector of the entity |
[in] | eps | epsilon value of the entity |
[out] | label | class of the entity |
Gets feature vector of the entity and gives class of the entity.
Used for lazy naive reads on on-disk
[in] | vec | feature vector of the entity |
[out] | label | class of the entity |
Gets entity id and gives class of entity.
[in] | entity_id | id of the entity |
[out] | c | class of the entity |
Gives the # of entities that belong to the given class c.
[in] | c | class that we are looking for |
[out] | nClass | number of entities that belong to class c |
void Hazy_Sgd< T >::update_low_high_water | ( | ) | [inline, protected] |
Calculates low & high water values.
Updates model with given example and updates external results accordingly.
[in] | vec | feature vector of given example |
[in] | label | class of given example |
void Hazy_Sgd< T >::updateModel | ( | ) | [protected] |
According to the strategy, updates storage manager.
bool Hazy_Sgd< T >::_high_low_water_valid [protected] |
LAZY_HAZY flags if (_high_low_water_valid) then the high and the low water in the model are valid the model will become invalidated on a lazy_hazy update.
if the model is invalid on a lazy_hazy read, then the high and low water need to be recomputed.
struct model Hazy_Sgd< T >::_last_sort_model [protected] |
The model that the entities are clustered on.
_connection_map Hazy_Sgd< T >::connections [protected] |
struct hazy_model Hazy_Sgd< T >::hm [protected] |
Keeps track of the hazy model Kept up-to-date by SGD code (so needs to be initialized after) Also contains the low and high water values.
IncrementalSGD<T>* Hazy_Sgd< T >::sgd [protected] |
Sgd model which is maintained.
Skiing object that maintains low & high water, acc cost and resort cost.
Storage_Manager<T>* Hazy_Sgd< T >::st_man [protected] |
Storage manager object that updates related storages for entities.