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

Feature Normalizer. More...

#include <FeatureProcess.h>

Inheritance diagram for FeatureNormalizer:
FeatureProcessor SerializableObject

Public Member Functions

 FeatureNormalizer (const string &feature_name)
 
 FeatureNormalizer (const string &feature_name, string init_string)
 
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.
 
int Learn (MedFeatures &features, unordered_set< int > &ids)
 
int _apply (MedFeatures &features, unordered_set< int > &ids)
 
void reverse_apply (float &feature_value) const
 Reverse action of Apply - denorm feature value.
 
int init (map< string, string > &mapper)
 The parsed fields from init command.
 
void init_defaults ()
 
virtual void copy (FeatureProcessor *processor)
 
- Public Member Functions inherited from FeatureProcessor
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
 Missing Value.
 
bool normalizeSd
 Normalize Standard Deviation.
 
bool fillMissing
 Fill missing values with mean.
 
float mean
 Moments.
 
float sd
 
int resolution = 0
 resolution : if > 0 , will keep only the given number of digits after the point.
 
float resolution_bin
 A factor to divide by - take floor and then multiply by again. Used in resolution_only mode.
 
int max_samples = 0
 Utility : maximum number of samples to take for moments calculations.
 
bool resolution_only = false
 if resolution only
 
int verbosity = 0
 verbosity
 
bool use_linear_transform = false
 If true will convert into linear transform from lower prctile to high prctile and has triming value.
 
float max_val_prctile = 1
 
float max_val_for_triming = 2
 
float prctile_th = (float)0.001
 
float min_x
 
float max_x
 parmeters of the transformation
 
- 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

Feature Normalizer.

To Use this selector specify "normalizer" in the fp_type

Member Function Documentation

◆ _apply()

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

Reimplemented from FeatureProcessor.

◆ copy()

virtual void FeatureNormalizer::copy ( FeatureProcessor processor)
inlinevirtual

Reimplemented from FeatureProcessor.

◆ init()

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

The parsed fields from init command.

if (field == "missing_value") missing_value = stof(entry.second);
else if (field == "normalizeSd") normalizeSd = (med_stoi(entry.second) != 0);
else if (field == "resolution_only") resolution_only = (med_stoi(entry.second) != 0);
else if (field == "fillMissing") fillMissing = (med_stoi(entry.second) != 0);
else if (field == "max_samples") max_samples = med_stoi(entry.second);
else if (field == "resolution") resolution = med_stoi(entry.second);
else if (field == "resolution_bin") resolution_bin = med_stof(entry.second);
else if (field == "signal") set_feature_name(entry.second);
else if (field == "vorbosity") verbosity = med_stoi(entry.second);
else if (field == "use_linear_transform") use_linear_transform = med_stoi(entry.second) > 0;
else if (field == "max_val_prctile") max_val_prctile = med_stof(entry.second);
else if (field == "prctile_th") prctile_th = med_stof(entry.second);
else if (field == "max_val_for_triming") max_val_for_triming = med_stof(entry.second);
else if (field != "names" && field != "fp_type" && field != "tag")
MLOG("Unknonw parameter \'%s\' for FeatureNormalizer\n", field.c_str());
#define MLOG(fmt,...)
MLOG() - use LOCAL_SECTION and LOCAL_LEVEL.
Definition Logger.h:145
int resolution
resolution : if > 0 , will keep only the given number of digits after the point.
Definition FeatureProcess.h:302
bool use_linear_transform
If true will convert into linear transform from lower prctile to high prctile and has triming value.
Definition FeatureProcess.h:317
int verbosity
verbosity
Definition FeatureProcess.h:314
bool fillMissing
Fill missing values with mean.
Definition FeatureProcess.h:296
float resolution_bin
A factor to divide by - take floor and then multiply by again. Used in resolution_only mode.
Definition FeatureProcess.h:305
bool normalizeSd
Normalize Standard Deviation.
Definition FeatureProcess.h:293
bool resolution_only
if resolution only
Definition FeatureProcess.h:311
float missing_value
Missing Value.
Definition FeatureProcess.h:290
int max_samples
Utility : maximum number of samples to take for moments calculations.
Definition FeatureProcess.h:308

[FeatureNormalizer::init]

[FeatureNormalizer::init]

Reimplemented from FeatureProcessor.

◆ Learn()

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

Reimplemented from FeatureProcessor.

◆ select_learn_matrix()

string FeatureNormalizer::select_learn_matrix ( const vector< string > &  matrix_tags) const
virtual

Will be called before learn to create new version for the matrix if needed - in parallel of existing matrix.

Reimplemented from FeatureProcessor.


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