Medial Code Documentation
Loading...
Searching...
No Matches
Public Member Functions
GibbsSamplesGenerator< T > Class Template Reference

Samples generator using GibbsSampler object to sample from data dist. More...

#include <SamplesGenerator.h>

Inheritance diagram for GibbsSamplesGenerator< T >:
SamplesGenerator< T > SerializableObject

Public Member Functions

 GibbsSamplesGenerator (GibbsSampler< T > &gibbs, bool do_parallel=true, bool no_need_clear_mem=true)
 
void prepare (void *params)
 prepare to generate
 
void learn (const map< string, vector< T > > &data, const vector< string > &learn_features, bool skip_missing)
 learn of sample generator
 
void get_samples (map< string, vector< T > > &data, void *params, const vector< bool > &mask, const vector< T > &mask_values)
 apply of sample generator - deafult arguments with mask, and mask values to generate values in mask, where mask[i]==false.
 
void get_samples (MedMat< T > &data, int sample_per_row, void *params, const vector< vector< bool > > &mask, const MedMat< T > &mask_values)
 vector api from generating samples
 
void get_samples (map< string, vector< T > > &data, void *params, const vector< bool > &mask, const vector< T > &mask_values, mt19937 &rnd_gen) const
 apply of sample generator - deafult arguments with mask, and mask values to generate values in mask, where mask[i]==false.
 
void get_samples (MedMat< T > &data, int sample_per_row, void *params, const vector< vector< bool > > &mask, const MedMat< T > &mask_values, mt19937 &rnd_gen) const
 vector api from generating samples
 
void pre_serialization ()
 
void post_deserialization ()
 
- Public Member Functions inherited from SamplesGenerator< T >
void learn (const map< string, vector< T > > &data)
 learn of sample generator
 
void * new_polymorphic (string derived_name)
 for polymorphic classes that want to be able to serialize/deserialize a pointer * to the derived class given its type one needs to implement this function to return a new to the derived class given its type (as in my_type)
 
void pre_serialization ()
 
void post_deserialization ()
 
- Public Member Functions inherited from SerializableObject
virtual int version () const
 Relevant for serializations.
 
virtual string my_class_name () const
 For better handling of serializations it is highly recommended that each SerializableObject inheriting class will implement the next method.
 
virtual void serialized_fields_name (vector< string > &field_names) const
 The names of the serialized fields.
 
virtual size_t get_size ()
 Gets bytes sizes for serializations.
 
virtual size_t serialize (unsigned char *blob)
 Serialiazing object to blob memory. return number ob bytes wrote to memory.
 
virtual size_t deserialize (unsigned char *blob)
 Deserialiazing blob to object. returns number of bytes read.
 
size_t serialize_vec (vector< unsigned char > &blob)
 
size_t deserialize_vec (vector< unsigned char > &blob)
 
virtual size_t serialize (vector< unsigned char > &blob)
 
virtual size_t deserialize (vector< unsigned char > &blob)
 
virtual int read_from_file (const string &fname)
 read and deserialize model
 
virtual int write_to_file (const string &fname)
 serialize model and write to file
 
virtual int read_from_file_unsafe (const string &fname)
 read and deserialize model without checking version number - unsafe read
 
int init_from_string (string init_string)
 Init from string.
 
int init_params_from_file (string init_file)
 
int init_param_from_file (string file_str, string &param)
 
virtual int init (map< string, string > &map)
 Virtual to init object from parsed fields.
 
int update_from_string (const string &init_string)
 
virtual int update (map< string, string > &map)
 Virtual to update object from parsed fields.
 
virtual string object_json () const
 

Additional Inherited Members

- Data Fields inherited from SamplesGenerator< T >
bool use_vector_api = true
 In gibbs it's faster to use map<string, float> api.
 
- Protected Member Functions inherited from SamplesGenerator< T >
 SamplesGenerator (bool _use_vector_api)
 

Detailed Description

template<typename T>
class GibbsSamplesGenerator< T >

Samples generator using GibbsSampler object to sample from data dist.

Member Function Documentation

◆ get_samples() [1/4]

template<typename T >
void GibbsSamplesGenerator< T >::get_samples ( map< string, vector< T > > &  data,
void *  params,
const vector< bool > &  mask,
const vector< T > &  mask_values 
)
virtual

apply of sample generator - deafult arguments with mask, and mask values to generate values in mask, where mask[i]==false.

when mask[i]==true fix values from mask_values

Reimplemented from SamplesGenerator< T >.

◆ get_samples() [2/4]

template<typename T >
void GibbsSamplesGenerator< T >::get_samples ( map< string, vector< T > > &  data,
void *  params,
const vector< bool > &  mask,
const vector< T > &  mask_values,
mt19937 &  rnd_gen 
) const
virtual

apply of sample generator - deafult arguments with mask, and mask values to generate values in mask, where mask[i]==false.

when mask[i]==true fix values from mask_values

Reimplemented from SamplesGenerator< T >.

◆ get_samples() [3/4]

template<typename T >
void GibbsSamplesGenerator< T >::get_samples ( MedMat< T > &  data,
int  sample_per_row,
void *  params,
const vector< vector< bool > > &  mask,
const MedMat< T > &  mask_values 
)
virtual

vector api from generating samples

Reimplemented from SamplesGenerator< T >.

◆ get_samples() [4/4]

template<typename T >
void GibbsSamplesGenerator< T >::get_samples ( MedMat< T > &  data,
int  sample_per_row,
void *  params,
const vector< vector< bool > > &  mask,
const MedMat< T > &  mask_values,
mt19937 &  rnd_gen 
) const
virtual

vector api from generating samples

Reimplemented from SamplesGenerator< T >.

◆ learn()

template<typename T >
void GibbsSamplesGenerator< T >::learn ( const map< string, vector< T > > &  data,
const vector< string > &  learn_features,
bool  skip_missing 
)
virtual

learn of sample generator

Reimplemented from SamplesGenerator< T >.

◆ post_deserialization()

template<typename T >
void GibbsSamplesGenerator< T >::post_deserialization ( )
virtual

Reimplemented from SerializableObject.

◆ pre_serialization()

template<typename T >
void GibbsSamplesGenerator< T >::pre_serialization ( )
virtual

Reimplemented from SerializableObject.

◆ prepare()

template<typename T >
void GibbsSamplesGenerator< T >::prepare ( void *  params)
virtual

prepare to generate

Reimplemented from SamplesGenerator< T >.


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