Medial Code Documentation
Loading...
Searching...
No Matches
Public Member Functions | Data Fields
IterativeImputer Class Reference


IterativeImputer

A general strong imputer that does the following:
(1) Runs a simple stratified imputer
(2) Runs iterations completing values (from the least missing to the max missing) where:
(a) continuous values are calculated using a regressor
(b) categorial values (less than some bound) are calculated using a multi category classifier
(3) Repeats the process several times until it converges or until max_iters is reached. More...

#include <IterativeImputer.h>

Inheritance diagram for IterativeImputer:
SerializableObject

Public Member Functions

int init (map< string, string > &mapper)
 The parsed fields from init command.
 
int init_internals (MedFeatures &mfd)
 
int init_feature_info (MedFeatures &mfd, string feat_name)
 
int init_feature_info_update (MedFeatures &mfd, feature_info &fi)
 
int round_to_resolution (MedFeatures &mfd)
 
int round_arr (float *arr, int len, float resolution, float _min, float _max)
 
int learn_first_round (MedFeatures &mfd)
 
int learn_iteration (MedFeatures &mfd, int iter)
 
int apply_first_round (MedFeatures &mfd, bool learning)
 
int apply_iteration (MedFeatures &mfd, int iter)
 
int find_feats_to_learn_from (int f_idx)
 
int feats_for_pred_inds_to_names (feature_info &fi)
 
int Learn (MedFeatures &mfd)
 
int Apply (MedFeatures &mfd, bool learning)
 
- 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 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 void pre_serialization ()
 
virtual void post_deserialization ()
 
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)
 
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

IterativeImputerParams params
 
vector< int > train_idx
 
vector< int > test_idx
 
vector< char > is_train
 
MedFeatures learn_features_map
 
unordered_set< int > train_ids
 
unordered_set< int > test_ids
 
vector< feature_infofeats
 
vector< FeatureImputerfirst_round_imputers
 
vector< int > predictors_order
 
vector< vector< MedPredictor * > > predictors
 

Detailed Description


IterativeImputer

A general strong imputer that does the following:
(1) Runs a simple stratified imputer
(2) Runs iterations completing values (from the least missing to the max missing) where:
(a) continuous values are calculated using a regressor
(b) categorial values (less than some bound) are calculated using a multi category classifier
(3) Repeats the process several times until it converges or until max_iters is reached.


Member Function Documentation

◆ init()

int IterativeImputer::init ( map< string, string > &  mapper)
inlinevirtual

The parsed fields from init command.

if (field == "regressor") regressor = entry.second;
else if (field == "regressor_params") regressor_params = entry.second;
else if (field == "multi_categ_classifier") multi_categ_classifier = entry.second;
else if (field == "multi_categ_classifier_params") multi_categ_classifier_params = entry.second;
else if (field == "add_ncateg_var_name") add_ncateg_var_name = entry.second;
else if (field == "round1_strata") round1_strata = entry.second;
else if (field == "do_round1") do_round1 = stoi(entry.second);
else if (field == "round1_moment") round1_moment = stoi(entry.second);
else if (field == "categorial_bound") categorial_bound = stoi(entry.second);
else if (field == "max_iterations") max_iterations = stoi(entry.second);
else if (field == "p_validation") p_validation = stof(entry.second);
else if (field == "min_vals_for_training") min_vals_for_training = stoi(entry.second);
else if (field == "missing_value") missing_value = stof(entry.second);
else if (field == "missing_bound") missing_bound = stof(entry.second);
else if (field == "round_to_resolution") round_to_resolution = stoi(entry.second);
else if (field == "verbose") verbose = stoi(entry.second);
else if (field == "features" || field == "names") {
vector<string> f;
boost::split(f, entry.second, boost::is_any_of(",:"));
features_to_impute.insert(features_to_impute.end(), f.begin(), f.end());
}

Reimplemented from SerializableObject.

◆ init_feature_info()

int IterativeImputer::init_feature_info ( MedFeatures mfd,
string  feat_name 
)

if (fi.n_missing > 0 && fi.n_with_values > 0)


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