Medial Code Documentation
Loading...
Searching...
No Matches
PredictorImputer.h
1#ifndef _FTR_PREDICTOR_IMPUTER_H_
2#define _FTR_PREDICTOR_IMPUTER_H_
3
4#include <string>
5#include <random>
6#include <MedAlgo/MedAlgo/BinSplitOptimizer.h>
7#include <MedProcessTools/MedProcessTools/Calibration.h>
8#include <MedAlgo/MedAlgo/SamplesGenerator.h>
9
10using namespace std;
11
17private:
18 unique_ptr<SamplesGenerator<float>> _sampler = NULL;
19 void *sampler_sampling_args = NULL;
20
22 GibbsSamplingParams _gibbs_sample_params;
23 int n_masks = 1;
24 vector<string> impute_features;
25
26 void init_sampler(bool with_sampler = true);
27
28 mt19937 gen;
29public:
33 string tag_search;
34
35 GeneratorType gen_type;
38
39 PredictorImputer() : FeatureProcessor() { init_defaults(); }
40
41 // Copy
42 //void copy(FeatureProcessor *processor) { *this = *(dynamic_cast<PredictorImputer *>(processor)); }
43
44 void init_defaults();
45
46 void post_deserialization();
47
48 void load_GIBBS(const GibbsSampler<float> &gibbs, const GibbsSamplingParams &sampling_args);
49 void load_GAN(const string &gan_path);
50 void load_MISSING();
51 void load_sampler(unique_ptr<SamplesGenerator<float>> &&generator);
52
55 int init(map<string, string>& mapper);
56
57 // Learn cleaning model
58 int Learn(MedFeatures& features, unordered_set<int>& ids);
59
60 // Apply cleaning model
61 int _apply(MedFeatures& features, unordered_set<int>& ids);
62
63 // Serialization
64 ADD_CLASS_NAME(PredictorImputer)
65 ADD_SERIALIZATION_FUNCS(processor_type, tag_search, missing_value, gen_type, _sampler,
67};
68
70
71
72#endif
#define ADD_SERIALIZATION_FUNCS(...)
Definition SerializableObject.h:122
#define MEDSERIALIZE_SUPPORT(Type)
Definition SerializableObject.h:108
Definition FeatureProcess.h:51
A gibbs sampler - has learn and create sample based on mask.
Definition GibbsSampler.h:89
A class that contains all sampling arguments.
Definition GibbsSampler.h:71
A class for holding features data as a virtual matrix
Definition MedFeatures.h:47
Predictor Imputer - use all features in the matrix to predict value to impute selects randomly a valu...
Definition PredictorImputer.h:16
bool verbose_learn
if true will output more info when learning
Definition PredictorImputer.h:31
float missing_value
missing value to look for to impute
Definition PredictorImputer.h:30
string sampling_args
args for sampling
Definition PredictorImputer.h:37
int init(map< string, string > &mapper)
The parsed fields from init command.
Definition PredictorImputer.cpp:70
string tag_search
feature tag search
Definition PredictorImputer.h:33
bool verbose_apply
if true will output verbose output in apply
Definition PredictorImputer.h:32
string generator_args
for learn
Definition PredictorImputer.h:36
GeneratorType gen_type
generator type
Definition PredictorImputer.h:35
Abstract Random Samples generator.
Definition SamplesGenerator.h:34
Definition StdDeque.h:58