Hazy_Sgd< T > Class Template Reference

This class handles all queries sent by triggers It uses locks for public functions to handle parallelism. More...

#include <hazy_sgd.h>

Inheritance diagram for Hazy_Sgd< T >:

Multiclass_Specialized_Hazy_Sgd< T > Read_Specialized_Hazy_Sgd< T > List of all members.

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.

Detailed Description

template<class T>
class Hazy_Sgd< T >

This class handles all queries sent by triggers It uses locks for public functions to handle parallelism.


Member Typedef Documentation

template<class T>
typedef std::map<std::string, Hazy_Database*> Hazy_Sgd< T >::_connection_map [protected]


Constructor & Destructor Documentation

template<class T>
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.

Parameters:
[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


Member Function Documentation

template<class T>
void Hazy_Sgd< T >::deleteModel ( std::string  db_name,
std::string  table_name 
)

template<class T>
void Hazy_Sgd< T >::holder_difference_models ( double &  delta_w,
double &  delta_b 
) [protected]

Calculates differences between models.

Parameters:
[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

template<class T>
void Hazy_Sgd< T >::readEntityClass ( vec,
double  eps,
sClass label 
)

Gets feature vector and eps of the entity and gives class of the entity.

Used for lazy hazy reads on on-disk

Parameters:
[in] vec feature vector of the entity
[in] eps epsilon value of the entity
[out] label class of the entity

template<class T>
void Hazy_Sgd< T >::readEntityClass ( vec,
sClass label 
)

Gets feature vector of the entity and gives class of the entity.

Used for lazy naive reads on on-disk

Parameters:
[in] vec feature vector of the entity
[out] label class of the entity

template<class T>
void Hazy_Sgd< T >::readEntityClass ( key  entity_id,
sClass c 
)

Gets entity id and gives class of entity.

Parameters:
[in] entity_id id of the entity
[out] c class of the entity

template<class T>
void Hazy_Sgd< T >::readNumInClass ( sClass  c,
int &  nClass 
)

Gives the # of entities that belong to the given class c.

Parameters:
[in] c class that we are looking for
[out] nClass number of entities that belong to class c

template<class T>
void Hazy_Sgd< T >::update_low_high_water (  )  [inline, protected]

Calculates low & high water values.

template<class T>
void Hazy_Sgd< T >::updateModel ( vec,
sClass  label 
)

Updates model with given example and updates external results accordingly.

Parameters:
[in] vec feature vector of given example
[in] label class of given example

template<class T>
void Hazy_Sgd< T >::updateModel (  )  [protected]

According to the strategy, updates storage manager.


Member Data Documentation

template<class T>
int Hazy_Sgd< T >::_dim [protected]

template<class T>
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.

template<class T>
struct model Hazy_Sgd< T >::_last_sort_model [protected]

The model that the entities are clustered on.

template<class T>
pthread_rwlock_t Hazy_Sgd< T >::_rwlock [protected]

Fine-grained read-write lock.

template<class T>
_connection_map Hazy_Sgd< T >::connections [protected]

template<class T>
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.

template<class T>
IncrementalSGD<T>* Hazy_Sgd< T >::sgd [protected]

Sgd model which is maintained.

template<class T>
Skiing Hazy_Sgd< T >::ski [protected]

Skiing object that maintains low & high water, acc cost and resort cost.

template<class T>
Storage_Manager<T>* Hazy_Sgd< T >::st_man [protected]

Storage manager object that updates related storages for entities.


The documentation for this class was generated from the following files:
Generated on Wed Dec 15 10:46:16 2010 for Hazy_System by  doxygen 1.4.7