Medial Code Documentation
Loading...
Searching...
No Matches
MedModel.h
Go to the documentation of this file.
1
2
3#ifndef _MED_MODEL_H_
4#define _MED_MODEL_H_
5
6#include "InfraMed/InfraMed/InfraMed.h"
9#include "MedProcessTools/MedProcessTools/DoCalcFeatProcessor.h"
13#include "MedProcessTools/MedProcessTools/MedSamples.h"
15#include "MedProcessTools/MedProcessTools/MedModelExceptions.h"
16#include <boost/property_tree/ptree.hpp>
17#include "Effected_Field.h"
18
19using namespace boost::property_tree;
20
35
36class PostProcessor;
37
39public:
40 string change_name = "";
41 string object_type_name = "";
42 vector<string> json_query_whitelist;
43 vector<string> json_query_blacklist;
44 string change_command = "";
45 int verbose_level = 2;
46
47 int init(map<string, string>& mapper);
48
49 static void parse_json_string(const string &json_content, vector<ChangeModelInfo> &res);
50
51 ADD_CLASS_NAME(ChangeModelInfo)
54};
56class MedModel final : public SerializableObject {
57public:
58 string version_info = "";
62
63 long long max_data_in_mem = 0;
69
71 vector<RepProcessor *> rep_processors;
72
74 vector<FeatureGenerator *> generators;
75
77 vector<FeatureProcessor *> feature_processors;
78
80 vector<PostProcessor *> post_processors;
81
84
87
89 bool take_mean_pred = true;
90
92 unordered_set<string> required_signal_names;
93 unordered_set<int> required_signal_ids;
94 vector<unordered_set<string> > required_features_vec;
95 unordered_set<string> required_feature_generators;
96
98 map<string, int> virtual_signals;
99 map<string, string> virtual_signals_generic;
100
101 // Constructor/Destructor
103 ~MedModel() { clear(); };
104
105 void clear();
106
108
109 int verbosity = 1;
110
111 int generate_masks_for_features = 0;
112
113 // initialize from configuration files
114 //int init_rep_processors(const string &fname);
115 //int init_feature_generators(const string &fname);
116
123 void change_model(const ChangeModelInfo &change_request);
130 void change_model(const vector<ChangeModelInfo> &change_request);
131
132 // staging
133 static MedModelStage get_med_model_stage(const string& stage);
134
136 void add_rep_processor(RepProcessor *processor) { rep_processors.push_back(processor); };
137 void add_rep_processors_set(RepProcessorTypes type, vector<string>& signals);
138 void add_rep_processors_set(RepProcessorTypes type, vector<string>& signals, string init_string);
139 void insert_rep_processor(string init_string, int index);
140
142 void add_feature_generator(FeatureGenerator *generator) { generators.push_back(generator); }
143 void add_feature_generators(FeatureGeneratorTypes type, vector<string>& signals);
144 void add_feature_generators(FeatureGeneratorTypes type, vector<string>& signals, string init_string);
145 void add_feature_generator(FeatureGeneratorTypes type, string& signal) { vector<string> signals(1, signal); add_feature_generators(type, signals); }
146 void add_feature_generators(FeatureGeneratorTypes type, string& signal, string init_string) { vector<string> signals(1, signal); add_feature_generators(type, signals, init_string); }
147
148 void add_feature_generators(string& name, vector<string>& signals) { add_feature_generators(ftr_generator_name_to_type(name), signals); }
149 void add_feature_generators(string& name, vector<string>& signals, string init_string) { add_feature_generators(ftr_generator_name_to_type(name), signals, init_string); }
150 void add_feature_generator(string& name, string& signal) { vector<string> signals(1, signal); add_feature_generators(name, signals); }
151 void add_feature_generators(string& name, string& signal, string init_string) { vector<string> signals(1, signal); add_feature_generators(name, signals, init_string); }
152
153 void add_age() { generators.push_back(new AgeGenerator); }
154 void add_gender() { generators.push_back(new GenderGenerator); }
155
156 void get_all_features_names(vector<string> &feat_names, int before_process_set);
157
159 void add_feature_processor(FeatureProcessor *processor) { feature_processors.push_back(processor); };
160
161 void add_feature_processors_set(FeatureProcessorTypes type);
162 void add_feature_processors_set(FeatureProcessorTypes type, string init_string);
163 void add_feature_processors_set(FeatureProcessorTypes type, vector<string>& features);
164 void add_feature_processors_set(FeatureProcessorTypes type, vector<string>& features, string init_string);
165
166 void add_normalizers() { add_feature_processors_set(FTR_PROCESS_NORMALIZER); }
167 void add_normalizers(string init_string) { add_feature_processors_set(FTR_PROCESS_NORMALIZER, init_string); }
168 void add_normalizers(vector<string>& features) { add_feature_processors_set(FTR_PROCESS_NORMALIZER, features); }
169 void add_normalizers(vector<string>& features, string init_string) { add_feature_processors_set(FTR_PROCESS_NORMALIZER, features, init_string); }
170
171 void add_imputers() { add_feature_processors_set(FTR_PROCESS_IMPUTER); }
172 void add_imputers(string init_string) { add_feature_processors_set(FTR_PROCESS_IMPUTER, init_string); }
173 void add_imputers(vector<string>& features) { add_feature_processors_set(FTR_PROCESS_IMPUTER, features); }
174 void add_imputers(vector<string>& features, string init_string) { add_feature_processors_set(FTR_PROCESS_IMPUTER, features, init_string); }
175
176 //post procesors:
177 void add_post_processor(PostProcessor *processor) { post_processors.push_back(processor); };
178
179 // general adders for easier handling of config files/lines
180 // the idea is to add to a specific set and let the adder create a multi if needed
181 int init_from_json_string(string& json_string, const string& fname);
182 void init_from_json_file(const string& fname) { vector<string> dummy; init_from_json_file_with_alterations(fname, dummy); }
183 void init_from_json_file_with_alterations_version_1(const string& fname, vector<string>& alterations);
184 void init_from_json_file_with_alterations(const string& fname, vector<string>& alterations);
185 int add_pre_processors_json_string_to_model(string in_json, string fname) { vector<string> dummy; return add_pre_processors_json_string_to_model(in_json, fname, dummy); }
186 int add_pre_processors_json_string_to_model(string in_json, string fname, vector<string> &alterations, bool add_rep_first = false);
187 int add_post_processors_json_string_to_model(string in_json, string fname) { vector<string> dummy; return add_post_processors_json_string_to_model(in_json, fname, dummy); }
188 int add_post_processors_json_string_to_model(string in_json, string fname, vector<string> &alterations);
189 void add_rep_processor_to_set(int i_set, const string &init_string); // rp_type and signal are must have parameters in this case
190 void add_feature_generator_to_set(int i_set, const string &init_string); // fg_type and signal are must have parameters
191 void add_feature_processor_to_set(int i_set, int duplicate, const string &init_string); // fp_type and feature name are must have parameters
192 void add_process_to_set(int i_set, int duplicate, const string &init_string); // will auto detect type by which type param is used (rp_type, fg_type OR fp_type)
193 // and will call the relavant function
194 void add_process_to_set(int i_set, const string &init_string) { add_process_to_set(i_set, 0, init_string); }
195 void add_post_processor_to_set(int i_set, const string &init_string);
196
198 void set_predictor(MedPredictor *_predictor) { predictor = _predictor; };
199 void set_predictor(MedPredictorTypes type) { predictor = MedPredictor::make_predictor(type); }
200 void set_predictor(string name) { predictor = MedPredictor::make_predictor(name); }
201 void set_predictor(MedPredictorTypes type, string init_string) { predictor = MedPredictor::make_predictor(type, init_string); }
202 void set_predictor(string name, string init_string) { predictor = MedPredictor::make_predictor(name, init_string); }
203 void replace_predictor_with_json_predictor(string f_json); // given a loaded model and a json file, replaces the model predictor definition with the one in the json.
204
206 void set_required_signal_ids(MedDictionarySections& dict, vector<RepProcessor *> &applied_rep_processors,
207 vector<FeatureGenerator *> &applied_generators);
208 void set_affected_signal_ids(MedDictionarySections& dict, vector<RepProcessor *> &applied_rep_processors);
209
210 // Required signals back-propogation
211 void get_required_signal_names(unordered_set<string>& signalNames) const;
212 void get_required_signal_names(vector<string>& signalNames) const; // same, but get as vector
214 void get_required_signal_names_for_processed_values(unordered_set<string>& targetSignalNames, unordered_set<string>& signalNames);
215 void get_required_signal_names_for_processed_values(unordered_set<string>& targetSignalNames, vector<string>& signalNames);
217 void get_generated_features_names(vector<string> &feat_names);
219 int get_nfeatures();
221 int get_duplicate_factor() const;
222
223 int collect_and_add_virtual_signals(MedRepository &rep);
224
225 void get_required_signal_categories(unordered_map<string, vector<string>> &signal_categories_in_use) const;
226
228 void init_all(MedDictionarySections& dict, MedSignals& sigs,vector<RepProcessor *> &applied_rep_processors,
229 vector<FeatureGenerator *> &applied_generators);
230 void init_all(MedDictionarySections& dict, MedSignals& sigs) { init_all(dict, sigs, rep_processors, generators); }
231 // Learn/Apply
232 int learn(MedPidRepository& rep, MedSamples* samples) { return learn(rep, samples, MED_MDL_LEARN_REP_PROCESSORS, MED_MDL_END); }
233 int learn(MedPidRepository& rep, MedSamples* samples, MedModelStage start_stage, MedModelStage end_stage);
234 int learn_skip_matrix_train(MedPidRepository &rep, MedSamples *samples, MedModelStage end_stage);
235 int apply(MedPidRepository& rep, MedSamples& samples) { return apply(rep, samples, MED_MDL_APPLY_FTR_GENERATORS, MED_MDL_END); }
236 int apply(MedPidRepository& rep, MedSamples& samples, MedModelStage start_stage, MedModelStage end_stage);
237
238 void no_init_apply_partial(MedPidRepository& rep, MedSamples& samples, const vector<Effected_Field> &requested_outputs);
239
240 // follows are apply methods separating the initialization of the model from the actual apply
241 int init_model_for_apply(MedPidRepository &rep, MedModelStage start_stage, MedModelStage end_stage);
242 int no_init_apply(MedPidRepository& rep, MedSamples& samples, MedModelStage start_stage, MedModelStage end_stage);
243
244 // Learn with a vector of samples - one for the actual learning, and additional one for each post-processor.
245 // PostProcessors that do not require samples, can be assigned empty samples.
246 int learn(MedPidRepository& rep, MedSamples& model_learning_set, vector<MedSamples>& post_processors_learning_sets) {
247 return learn(rep, model_learning_set, post_processors_learning_sets, MED_MDL_LEARN_REP_PROCESSORS, MED_MDL_END);
248 }
249 int learn(MedPidRepository& rep, MedSamples& model_learning_set, vector<MedSamples>& post_processors_learning_sets, MedModelStage start_stage, MedModelStage end_stage);
250
251 // Envelopes for normal calling
252 int learn(MedPidRepository& rep, MedSamples& samples) { return learn(rep, &samples); }
253 int learn(MedPidRepository& rep, MedSamples& samples, MedModelStage start_stage, MedModelStage end_stage) { return learn(rep, &samples, start_stage, end_stage); }
254
255 // Apply on a given Rec : this is needed when someone outside the model runs on Records. No matching method for learn.
256 // The process is started with an initialization using init_for_apply_rec
257 // Then for each record use : apply_rec , there's a flag for using a copy of the rec rather than the record itself.
258 // Calling apply_rec is thread safe, and hence each call returns its own MedFeatures.
259 int init_for_apply_rec(MedPidRepository &rep);
260 int apply_rec(PidDynamicRec &drec, MedIdSamples idSamples, MedFeatures &_feat, bool copy_rec_flag, int end_stage = MED_MDL_APPLY_FTR_PROCESSORS);
261
262 // De(Serialize)
263 virtual void pre_serialization() { if (!serialize_learning_set && LearningSet != NULL) LearningSet = NULL; /*no need to clear(), as this was given by the user*/ }
264 ADD_CLASS_NAME(MedModel)
266
267 int quick_learn_rep_processors(MedPidRepository& rep, MedSamples& samples);
268 int learn_rep_processors(MedPidRepository& rep, MedSamples& samples);
269 int learn_all_rep_processors(MedPidRepository& rep, MedSamples& samples);
270 void filter_rep_processors();
271 int learn_feature_generators(MedPidRepository &rep, MedSamples *learn_samples);
272 int generate_features(MedPidRepository &rep, MedSamples *samples, vector<FeatureGenerator *>& _generators, MedFeatures &features);
273 int generate_all_features(MedPidRepository &rep, MedSamples *samples, MedFeatures &features, unordered_set<string>& req_feature_generators);
274 int learn_and_apply_feature_processors(MedFeatures &features);
275 int learn_feature_processors(MedFeatures &features);
276 int apply_feature_processors(MedFeatures &features, bool learning);
277 int apply_feature_processors(MedFeatures &features, vector<unordered_set<string>>& req_features_vec, bool learning);
278 void build_req_features_vec(vector<unordered_set<string>>& req_features_vec) const;
279 void get_applied_generators(unordered_set<string>& req_feature_generators, vector<FeatureGenerator *>& _generators) const;
280
282 void dprint_process(const string &pref, int rp_flag, int fg_flag, int fp_flag, int predictor_flag, int pp_flag);
283
285 int write_feature_matrix(const string mat_fname, bool write_attributes = false, bool append = false);
286
288 void load_repository(const string& configFile, MedPidRepository& rep, bool allow_adjustment = false);
289 void load_repository(const string& configFile, vector<int> ids, MedPidRepository& rep, bool allow_adjustment = false);
290 void fit_for_repository(MedPidRepository& rep);
292 void read_from_file_with_changes(const string &model_binary_path, const string &path_to_json_changes);
293
295 void clone_model(MedModel &out);
297 void copy_from_model(MedModel &in);
298
301
303private:
304 void concatAllCombinations(const vector<vector<string> > &allVecs, size_t vecIndex, string strSoFar, vector<string>& result);
305 string parse_key_val(string key, string val);
306 void fill_list_from_file(const string& fname, vector<string>& list);
307 string make_absolute_path(const string& main_file, const string& small_file, bool use_cwd = false);
308 void alter_json(string &json_contents, vector<string>& alterations);
309 void insert_environment_params_to_json(string& json_content);
310 string json_file_to_string(int recursion_level, const string& main_file, vector<string>& alterations, const string& small_file = "", bool add_change_path = false);
311 void parse_action(basic_ptree<string, string>& action, vector<vector<string>>& all_action_attrs, int& duplicate, ptree& root, const string& fname);
312 int apply_predictor(MedSamples &samples);
313
314 // Handle learning sets for model/post-processors
315 void split_learning_set(MedSamples& inSamples, vector<MedSamples>& post_processors_learning_sets, MedSamples& model_learning_set);
316 void split_learning_set(MedSamples& inSamples_orig, vector<MedSamples>& post_processors_learning_sets_orig, vector<MedSamples>& post_processors_learning_sets, MedSamples& model_learning_set);
317
318 void clean_model();
319 void find_object(RepProcessor *c, vector<RepProcessor *> &res, vector<RepProcessor **> &res_pointer);
320 void find_object(FeatureGenerator *c, vector<FeatureGenerator *> &res, vector<FeatureGenerator **> &res_pointer);
321 void find_object(FeatureProcessor *c, vector<FeatureProcessor *> &res, vector<FeatureProcessor **> &res_pointer);
322 void find_object(PostProcessor *c, vector<PostProcessor *> &res, vector<PostProcessor **> &res_pointer);
323 void find_object(MedPredictor *c, vector<MedPredictor *> &res, vector<MedPredictor **> &res_pointer);
324
325
326 template <class T> void apply_change(const ChangeModelInfo &change_request, void *obj);
327
328 vector<FeatureGenerator *> applied_generators_to_use;
329 vector<RepProcessor *> applied_rep_processors_to_use;
330 void get_applied_pipeline(vector<unordered_set<string>> &req_features_vec, unordered_set<string> &required_feature_generators, vector<RepProcessor *> &applied_rep_processors,
331 vector<FeatureGenerator *> &applied_generators) const;
332 void get_applied_all(vector<unordered_set<string>> &req_features_vec, unordered_set<string> &required_feature_generators, vector<RepProcessor *> &applied_rep_processors,
333 vector<FeatureGenerator *> &applied_generators, unordered_set<string>& signalNames) const;
334};
335
336void filter_rep_processors(const vector<string> &current_req_signal_names, vector<RepProcessor *> *rep_processors);
337//=======================================
338// Joining the MedSerialze wagon
339//=======================================
341
342
345namespace medial {
349 namespace repository {
352 vector<int> prepare_repository(MedPidRepository &rep, const vector<int> &needed_sigs,
353 vector<int> &phisical_signal_read, vector<RepProcessor *> *rep_processors);
356 vector<string> prepare_repository(MedPidRepository &rep, const vector<string> &needed_sigs,
357 vector<string> &phisical_signal_read, vector<RepProcessor *> *rep_processors = NULL);
358
360 void prepare_repository(const vector<int> &pids, const string &RepositoryPath,
361 MedModel &mod, MedPidRepository &rep);
362
364 void prepare_repository(const MedSamples &samples, const string &RepositoryPath,
365 MedModel &mod, MedPidRepository &rep);
366 }
367
368 namespace medmodel {
369
371 void apply(MedModel &model, MedSamples &samples, string rep_fname, MedModelStage to_stage = MED_MDL_INSERT_PREDS); // returns just the model : model.features is updated. no need to read samples/already read
372 void apply(MedModel &model, string rep_fname, string f_samples, MedSamples &samples, MedModelStage to_stage = MED_MDL_INSERT_PREDS); // returns also a MedSamples object
373 void apply(MedModel &model, string rep_fname, string f_samples, MedModelStage to_stage = MED_MDL_INSERT_PREDS); // returns just the model : model.features is updated
374
375 }
376
377 namespace print {
378 void medmodel_logging(bool turn_on);
379 }
380}
381
382#endif
FeatureGenerator : creating features from raw signals.
FeatureGeneratorTypes
Definition FeatureGenerator.h:26
A virtual class of processes on MedFeatures; E.g.
FeatureProcessorTypes
Definition FeatureProcess.h:21
@ FTR_PROCESS_IMPUTER
"imputer" to create FeatureImputer
Definition FeatureProcess.h:25
@ FTR_PROCESS_NORMALIZER
"normalizer" to create FeatureNormalizer
Definition FeatureProcess.h:24
MedAlgo - APIs to different algorithms: Linear Models, RF, GBM, KNN, and more.
MedPredictorTypes
Definition MedAlgo.h:44
MedModelStage
MedModel learn/apply stages.
Definition MedModel.h:22
@ MED_MDL_APPLY_FTR_PROCESSORS
Start from apply feature processors (already learned)
Definition MedModel.h:27
@ MED_MDL_APPLY_FTR_GENERATORS
Start from apply feature generators (already learned)
Definition MedModel.h:25
@ MED_MDL_LEARN_FTR_PROCESSORS
Start from learning feature processors.
Definition MedModel.h:26
@ MED_MDL_LEARN_POST_PROCESSORS
Start learning of post_processors.
Definition MedModel.h:31
@ MED_MDL_INSERT_PREDS
We have done predict - save results.
Definition MedModel.h:30
@ MED_MDL_LEARN_FTR_GENERATORS
Start from learning feature generators.
Definition MedModel.h:24
@ MED_MDL_LEARN_PREDICTOR
We have the matrix - learn predcitor.
Definition MedModel.h:28
@ MED_MDL_APPLY_PREDICTOR
We have trained predcitor, do predict.
Definition MedModel.h:29
@ MED_MDL_LEARN_REP_PROCESSORS
Start from learning rep processors.
Definition MedModel.h:23
@ MED_MDL_END
All Done.
Definition MedModel.h:33
@ MED_MDL_APPLY_POST_PROCESSORS
start apply of postProcessors
Definition MedModel.h:32
RepProcessor is the parent class for processing a MedRepository or PidDynamicRec Basic functionalitie...
RepProcessorTypes
Define types of repository processors.
Definition RepProcess.h:20
An Abstract class that can be serialized and written/read from file.
#define ADD_SERIALIZATION_FUNCS(...)
Definition SerializableObject.h:122
#define MEDSERIALIZE_SUPPORT(Type)
Definition SerializableObject.h:108
Age Generator.
Definition FeatureGenerator.h:383
Definition MedModel.h:38
string object_type_name
Object type to change - should match my_class_name() of Serialization Object.
Definition MedModel.h:41
vector< string > json_query_whitelist
array of AND condition by regex search for those patterns in the json - to whitelist
Definition MedModel.h:42
vector< string > json_query_blacklist
array of AND condition by regex search for those patterns in the json - to blacklist
Definition MedModel.h:43
string change_name
documentation of change name
Definition MedModel.h:40
int init(map< string, string > &mapper)
Virtual to init object from parsed fields.
Definition MedModel.cpp:2981
string change_command
the command, might be "DELETE" ot delete element, "PRINT" to print element ot otherwise pass into obj...
Definition MedModel.h:44
int verbose_level
0 - no output, 1 - only warnings, 2 - also info
Definition MedModel.h:45
Definition FeatureGenerator.h:53
Definition FeatureProcess.h:51
Gender.
Definition FeatureGenerator.h:477
Definition MedDictionary.h:87
A class for holding features data as a virtual matrix
Definition MedFeatures.h:47
MedIdSamples represent a collection of samples of a given id Additional (optinal) entries: split
Definition MedSamples.h:90
A model = repCleaner + featureGenerator + featureProcessor + MedPredictor.
Definition MedModel.h:56
MedSamples * LearningSet
Learning samples.
Definition MedModel.h:86
void change_model(const ChangeModelInfo &change_request)
change model object in run time
Definition MedModel.cpp:2899
int write_feature_matrix(const string mat_fname, bool write_attributes=false, bool append=false)
following is for debugging : writing the feature to a csv file as a matrix.
Definition MedModel.cpp:2173
long long max_data_in_mem
maximal data size in memory.
Definition MedModel.h:63
int get_duplicate_factor() const
returns the duplicate factor of the model - by how much each sample is duplicated by
Definition MedModel.cpp:2338
vector< RepProcessor * > rep_processors
Repostiroy-level cleaners; to be applied sequentially.
Definition MedModel.h:71
void init_all(MedDictionarySections &dict, MedSignals &sigs, vector< RepProcessor * > &applied_rep_processors, vector< FeatureGenerator * > &applied_generators)
Initialization : signal ids and tables.
Definition MedModel.cpp:1620
string version_info
a string that represents version info - filled in compile time from git info
Definition MedModel.h:58
MedPredictor * predictor
Predictor.
Definition MedModel.h:83
int verbosity
verbosity 0 -> much less printouts in predict
Definition MedModel.h:109
void get_generated_features_names(vector< string > &feat_names)
Get list of Features generated by the model, after everything was applied (RPs, FGs,...
Definition MedModel.cpp:2356
int model_json_version
the json version
Definition MedModel.h:61
MedPidRepository * p_rep
not serialized. stores pointer to rep used in Learn or Apply after call.
Definition MedModel.h:302
vector< FeatureGenerator * > generators
Feature Generators.
Definition MedModel.h:74
int get_nfeatures()
get model features size esstimation - number of columns
Definition MedModel.cpp:2313
vector< PostProcessor * > post_processors
Post Process level - calibrators, explainers...
Definition MedModel.h:80
void clone_model(MedModel &out)
clones this object into out
Definition MedModel.cpp:3035
void copy_from_model(MedModel &in)
copy in modle into this object
Definition MedModel.cpp:3042
void get_required_signal_names_for_processed_values(unordered_set< string > &targetSignalNames, unordered_set< string > &signalNames)
Required signals to generate processed values of target-signals.
Definition MedModel.cpp:1722
unordered_set< string > required_signal_names
All required signal names + ids.
Definition MedModel.h:92
void add_feature_generator(FeatureGenerator *generator)
Add Feature Generators.
Definition MedModel.h:142
int serialize_learning_set
remember learning set
Definition MedModel.h:60
void add_feature_processor(FeatureProcessor *processor)
Add Feature Processors.
Definition MedModel.h:159
int model_feature_count_hint
hint for feature counts to consider in batching.
Definition MedModel.h:68
void load_repository(const string &configFile, MedPidRepository &rep, bool allow_adjustment=false)
loading a repository (optionally allowing for adjustment to model according to available signals)
Definition MedModel.cpp:2596
void set_predictor(MedPredictor *_predictor)
Add Predictor.
Definition MedModel.h:198
void add_rep_processor(RepProcessor *processor)
Add Rep Processorsep.
Definition MedModel.h:136
map< string, int > virtual_signals
all collected virtual signals (name to type)
Definition MedModel.h:98
void dprint_process(const string &pref, int rp_flag, int fg_flag, int fp_flag, int predictor_flag, int pp_flag)
following is for debugging, it gets a prefix, and prints it along with information on rep_processors,...
Definition MedModel.cpp:1994
vector< FeatureProcessor * > feature_processors
Features-level cleaners; to be applied sequentially.
Definition MedModel.h:77
bool take_mean_pred
when having multiple prediction for same samples - how to aggregate preds - mean or median?
Definition MedModel.h:89
void read_from_file_with_changes(const string &model_binary_path, const string &path_to_json_changes)
Read binary model from file + json changes req for run-time (empty string for no changes)
Definition MedModel.cpp:3023
MedFeatures features
the created matrix - no need to serialize
Definition MedModel.h:107
void set_required_signal_ids(MedDictionarySections &dict, vector< RepProcessor * > &applied_rep_processors, vector< FeatureGenerator * > &applied_generators)
signal ids
Definition MedModel.cpp:1125
int get_apply_batch_count()
returns how many samples are done in a single batche (in apply)
Definition MedModel.cpp:577
Definition MedPidRepository.h:87
Base Interface for predictor.
Definition MedAlgo.h:78
Definition InfraMed.h:303
MedSamples represent a collection of samples per different id The data is conatined in a vector of ...
Definition MedSamples.h:129
Definition MedSignals.h:719
Definition MedPidRepository.h:127
An Abstract PostProcessor class.
Definition PostProcessor.h:39
Definition RepProcess.h:53
Definition SerializableObject.h:32
medial namespace for function
Definition InfraMed.h:667