Medial Code Documentation
Loading...
Searching...
No Matches
Public Member Functions | Data Fields | Protected Member Functions
SamplesGenerator< T > Class Template Reference

Abstract Random Samples generator. More...

#include <SamplesGenerator.h>

Inheritance diagram for SamplesGenerator< T >:
SerializableObject GibbsSamplesGenerator< T > MaskedGAN< T > MissingsSamplesGenerator< T > RandomSamplesGenerator< T > UnivariateSamplesGenerator< T >

Public Member Functions

virtual void prepare (void *params)
 prepare to generate
 
void learn (const map< string, vector< T > > &data)
 learn of sample generator
 
virtual void learn (const map< string, vector< T > > &data, const vector< string > &learn_features, bool skip_missing)
 learn of sample generator
 
virtual 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.
 
virtual 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
 
virtual 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.
 
virtual 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 * 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
 

Data Fields

bool use_vector_api = true
 In gibbs it's faster to use map<string, float> api.
 

Protected Member Functions

 SamplesGenerator (bool _use_vector_api)
 

Detailed Description

template<typename T>
class SamplesGenerator< T >

Abstract Random Samples generator.

Member Function Documentation

◆ get_samples() [1/4]

template<typename T >
void SamplesGenerator< 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 in GibbsSamplesGenerator< T >, MaskedGAN< T >, MissingsSamplesGenerator< T >, RandomSamplesGenerator< T >, and UnivariateSamplesGenerator< T >.

◆ get_samples() [2/4]

template<typename T >
void SamplesGenerator< 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 in GibbsSamplesGenerator< T >, MaskedGAN< T >, MissingsSamplesGenerator< T >, RandomSamplesGenerator< T >, and UnivariateSamplesGenerator< T >.

◆ get_samples() [3/4]

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

◆ get_samples() [4/4]

template<typename T >
void SamplesGenerator< 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

◆ learn()

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

◆ new_polymorphic()

template<typename T >
void * SamplesGenerator< T >::new_polymorphic ( string  derived_name)
virtual

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)

Reimplemented from SerializableObject.

◆ post_deserialization()

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

Reimplemented from SerializableObject.

◆ pre_serialization()

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

Reimplemented from SerializableObject.

◆ prepare()

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

prepare to generate

Reimplemented in MaskedGAN< T >, GibbsSamplesGenerator< T >, and MaskedGAN< T >.


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