Medial Code Documentation
|
puts values in each feature selected randomly from it's distribution More...
#include <SamplesGenerator.h>
Public Member Functions | |
int | init (map< string, string > &mapper) |
Virtual to init object from parsed fields. | |
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 () |
T | find_pos (const vector< T > &v, const vector< double > &cumsum, double p) const |
![]() | |
virtual void | prepare (void *params) |
prepare to generate | |
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) | |
![]() | |
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 ¶m) |
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 | |
T | missing_value = MED_MAT_MISSING_VALUE |
int | min_samples |
minimal count of samples in strata size to use strata | |
featureSetStrata | strata_settings |
strata settings | |
ADD_SERIALIZATION_FUNCS(feature_values, feature_val_probs, strata_feature_val_agg_prob, names, missing_value, strata_settings, strata_sizes, min_samples, strata_feature_val_agg_val) private vector< vector< double > > | feature_val_probs |
< first index is feature name, second is order index | |
vector< vector< vector< T > > > | strata_feature_val_agg_val |
indexed by strata, feature_name, index of sorted value | |
vector< vector< vector< double > > > | strata_feature_val_agg_prob |
indexed by strata, feature_name, index of sorted value | |
vector< int > | strata_sizes |
the strata size | |
vector< string > | names |
names for all features | |
![]() | |
bool | use_vector_api = true |
In gibbs it's faster to use map<string, float> api. | |
Additional Inherited Members | |
![]() | |
SamplesGenerator (bool _use_vector_api) | |
puts values in each feature selected randomly from it's distribution
|
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 >.
|
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 >.
|
virtual |
vector api from generating samples
Reimplemented from SamplesGenerator< T >.
|
virtual |
vector api from generating samples
Reimplemented from SamplesGenerator< T >.
|
virtual |
Virtual to init object from parsed fields.
Reimplemented from SerializableObject.
|
virtual |
learn of sample generator
Reimplemented from SamplesGenerator< T >.
|
virtual |
Reimplemented from SamplesGenerator< T >.
|
virtual |
Reimplemented from SamplesGenerator< T >.
ADD_SERIALIZATION_FUNCS (feature_values, feature_val_probs, strata_feature_val_agg_prob, names, missing_value, strata_settings, strata_sizes, min_samples, strata_feature_val_agg_val) private vector<vector<double> > UnivariateSamplesGenerator< T >::feature_val_probs |
< first index is feature name, second is order index
feature name to map of value and prob - first index is feature name, second is order index