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

GetProbProcessor: More...

#include <FeatureProcess.h>

Inheritance diagram for BinningFeatProcessor:
FeatureProcessor SerializableObject

Public Member Functions

 BinningFeatProcessor (const string &feature_name)
 
 BinningFeatProcessor (const string &feature_name, string init_string)
 
int Learn (MedFeatures &features, unordered_set< int > &ids)
 
int _apply (MedFeatures &features, unordered_set< int > &ids)
 
int init (map< string, string > &mapper)
 The parsed fields from init command.
 
virtual void copy (FeatureProcessor *processor)
 
 ADD_SERIALIZATION_FUNCS (processor_type, feature_name, resolved_feature_name, missing_value, missing_target_val, remove_origin, bin_sett, bin_format, one_hot, keep_original_val)
 
- Public Member Functions inherited from FeatureProcessor
virtual string select_learn_matrix (const vector< string > &matrix_tags) const
 Will be called before learn to create new version for the matrix if needed - in parallel of existing matrix.
 
virtual void clear ()
 
void init_defaults ()
 
virtual void set_feature_name (const string &feature_name)
 
virtual string get_feature_name ()
 
virtual void get_feature_names (vector< string > &feature_names)
 
int learn (MedFeatures &features)
 PostProcess of MedFeatures - on all ids.
 
int learn (MedFeatures &features, unordered_set< int > &ids)
 
virtual int _apply (MedFeatures &features, unordered_set< int > &ids, bool learning)
 
virtual int _conditional_apply (MedFeatures &features, unordered_set< int > &ids, unordered_set< string > &req_features, bool learning)
 
int apply (MedFeatures &features, bool learning)
 PostProcess of MedFeatures - on all or a subset of the ids calls virtaul function "_apply/_conditional_apply" for the specific implementation.
 
int apply (MedFeatures &features, unordered_set< string > &req_features, bool learning)
 
int apply (MedFeatures &features, unordered_set< int > &ids, bool learning)
 
int apply (MedFeatures &features, unordered_set< int > &ids, unordered_set< string > &req_features, bool learning)
 
int apply (MedFeatures &features)
 
int apply (MedFeatures &features, unordered_set< string > &req_features)
 
int apply (MedFeatures &features, unordered_set< int > &ids)
 
int apply (MedFeatures &features, unordered_set< int > &ids, unordered_set< string > &req_features)
 
virtual int init (void *processor_params)
 
virtual int filter (unordered_set< string > &features)
 Filter according to a subset of features.
 
string resolve_feature_name (MedFeatures &features, string substr)
 Utility : get corresponding name in MedFeatures.
 
virtual bool are_features_affected (unordered_set< string > &out_req_features)
 check if a set of features is affected by the current processor
 
virtual void update_req_features_vec (unordered_set< string > &out_req_features, unordered_set< string > &in_req_features)
 update sets of required as input according to set required as output to processor Empty sets = require everything.
 
virtual bool is_selector ()
 allows testing if this feature processor is a selector
 
void * new_polymorphic (string derived_class_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)
 
size_t get_processor_size ()
 
size_t processor_serialize (unsigned char *blob)
 
virtual void dprint (const string &pref, int rp_flag)
 
- 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 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

float missing_value = MED_MAT_MISSING_VALUE
 Missing Value.
 
float missing_target_val = MED_MAT_MISSING_VALUE
 missing value target mapping. converts missing value to this value
 
bool remove_origin = true
 If true will remove the original/source feature.
 
bool one_hot = true
 If true will split each bin value to one hot of 0/1.
 
bool keep_original_val = false
 only relevant in one hot mode.
 
string bin_format = "%2.1f"
 formating of feature name after binning
 
Binning_Wrapper bin_sett
 "bin_sett" parameter - controls how to bin the feature.
 
- Data Fields inherited from FeatureProcessor
string feature_name = "unset_feature_name"
 Feature name ( + name as appears in MedFeatures) ;.
 
string resolved_feature_name
 
FeatureProcessorTypes processor_type = FTR_PROCESS_LAST
 
int learn_nthreads
 
int clean_nthreads
 

Additional Inherited Members

- Static Public Member Functions inherited from FeatureProcessor
static FeatureProcessormake_processor (string processor_name)
 
static FeatureProcessormake_processor (FeatureProcessorTypes type)
 
static FeatureProcessormake_processor (string processor_name, string params)
 
static FeatureProcessormake_processor (FeatureProcessorTypes type, string params)
 

Detailed Description

GetProbProcessor:

Replace category with probability of outcome in training set To Use this processor specify "get_prob" in the fp_type

Member Function Documentation

◆ _apply()

int BinningFeatProcessor::_apply ( MedFeatures features,
unordered_set< int > &  ids 
)
virtual

Reimplemented from FeatureProcessor.

◆ copy()

virtual void BinningFeatProcessor::copy ( FeatureProcessor processor)
inlinevirtual

Reimplemented from FeatureProcessor.

◆ init()

int BinningFeatProcessor::init ( map< string, string > &  mapper)
virtual

The parsed fields from init command.

if (e.first == "name") feature_name = e.second;
else if (e.first == "missing_value") missing_value = med_stof(e.second);
else if (e.first == "missing_target_val") missing_target_val = med_stof(e.second);
else if (e.first == "bin_format") bin_format = e.second;
else if (e.first == "one_hot") one_hot = med_stoi(e.second) > 0;
else if (e.first == "remove_origin") remove_origin = med_stoi(e.second) > 0;
else if (e.first == "keep_original_val") keep_original_val = med_stoi(e.second) > 0;
else if (e.first == "bin_sett") bin_sett.init_from_string(e.second);
else if (e.first != "names" && e.first != "fp_type" && e.first != "tag")
MTHROW_AND_ERR("Unknown parameter \'%s\' for BinningFeatProcessor\n", e.first.c_str());
Binning_Wrapper bin_sett
"bin_sett" parameter - controls how to bin the feature.
Definition FeatureProcess.h:1235
bool one_hot
If true will split each bin value to one hot of 0/1.
Definition FeatureProcess.h:1228
string bin_format
formating of feature name after binning
Definition FeatureProcess.h:1232
float missing_value
Missing Value.
Definition FeatureProcess.h:1222
bool keep_original_val
only relevant in one hot mode.
Definition FeatureProcess.h:1230
bool remove_origin
If true will remove the original/source feature.
Definition FeatureProcess.h:1226
float missing_target_val
missing value target mapping. converts missing value to this value
Definition FeatureProcess.h:1224
string feature_name
Feature name ( + name as appears in MedFeatures) ;.
Definition FeatureProcess.h:55
int init_from_string(string init_string)
Init from string.
Definition SerializableObject.cpp:121

[BinningFeatProcessor::init]

[BinningFeatProcessor::init]

Reimplemented from FeatureProcessor.

◆ Learn()

int BinningFeatProcessor::Learn ( MedFeatures features,
unordered_set< int > &  ids 
)
virtual

Reimplemented from FeatureProcessor.

Field Documentation

◆ bin_sett

Binning_Wrapper BinningFeatProcessor::bin_sett

"bin_sett" parameter - controls how to bin the feature.

params must be supplied inside barckets {} in the json for example: "bin_sett" : "{bin_cutoffs=1,2,3}"


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