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

A Processor which contains a vector of simpler processors Useful for applying same cleaners on a set of features, for example. More...

#include <FeatureProcess.h>

Inheritance diagram for MultiFeatureProcessor:
FeatureProcessor SerializableObject

Public Member Functions

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.
 
void init_defaults ()
 
void clear ()
 
int init (map< string, string > &mapper)
 The parsed fields from init command.
 
virtual void copy (FeatureProcessor *processor)
 
int Learn (MedFeatures &features, unordered_set< int > &ids)
 
int _apply (MedFeatures &features, unordered_set< int > &ids, bool learning)
 
int _conditional_apply (MedFeatures &features, unordered_set< int > &ids, unordered_set< string > &req_features, bool learning)
 
virtual void get_feature_names (vector< string > &feature_names)
 
void add_processors_set (FeatureProcessorTypes type, vector< string > &features)
 
void add_processors_set (FeatureProcessorTypes type, vector< string > &features, string init_string)
 
int filter (unordered_set< string > &features)
 Filter according to a subset of features.
 
void dprint (const string &pref, int fp_flag)
 
bool are_features_affected (unordered_set< string > &out_req_features)
 check if a set of features is affected by the current processor
 
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
 
- Public Member Functions inherited from FeatureProcessor
void init_defaults ()
 
virtual void set_feature_name (const string &feature_name)
 
virtual string get_feature_name ()
 
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)
 
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)
 
string resolve_feature_name (MedFeatures &features, string substr)
 Utility : get corresponding name in MedFeatures.
 
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)
 
- 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

FeatureProcessorTypes members_type
 
string init_string
 
int duplicate
 
string tag
 
bool use_parallel_learn
 
bool use_parallel_apply
 
vector< FeatureProcessor * > processors
 
- 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

A Processor which contains a vector of simpler processors Useful for applying same cleaners on a set of features, for example.

To Use this selector specify "multi" or multi_processor in the fp_type

Member Function Documentation

◆ _apply()

int MultiFeatureProcessor::_apply ( MedFeatures features,
unordered_set< int > &  ids,
bool  learning 
)
virtual

Reimplemented from FeatureProcessor.

◆ _conditional_apply()

int MultiFeatureProcessor::_conditional_apply ( MedFeatures features,
unordered_set< int > &  ids,
unordered_set< string > &  req_features,
bool  learning 
)
virtual

Reimplemented from FeatureProcessor.

◆ are_features_affected()

bool MultiFeatureProcessor::are_features_affected ( unordered_set< string > &  out_req_features)
virtual

check if a set of features is affected by the current processor

Reimplemented from FeatureProcessor.

◆ clear()

void MultiFeatureProcessor::clear ( )
virtual

Reimplemented from FeatureProcessor.

◆ copy()

void MultiFeatureProcessor::copy ( FeatureProcessor processor)
virtual

Reimplemented from FeatureProcessor.

◆ dprint()

void MultiFeatureProcessor::dprint ( const string &  pref,
int  fp_flag 
)
virtual

Reimplemented from FeatureProcessor.

◆ filter()

int MultiFeatureProcessor::filter ( unordered_set< string > &  features)
virtual

Filter according to a subset of features.

Reimplemented from FeatureProcessor.

◆ get_feature_names()

void MultiFeatureProcessor::get_feature_names ( vector< string > &  feature_names)
virtual

Reimplemented from FeatureProcessor.

◆ init()

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

The parsed fields from init command.

if (field == "tag") tag = entry.second;
if (field == "init_string") { init_string = entry.second; has_init_str = true; }
if (field == "members_type") { members_type = (FeatureProcessorTypes)med_stoi(entry.second); has_type = true; }
if (field == "use_parallel_learn") use_parallel_learn = med_stoi(entry.second) > 0;
if (field == "use_parallel_apply") use_parallel_apply = med_stoi(entry.second) > 0;
FeatureProcessorTypes
Definition FeatureProcess.h:21

[MultiFeatureProcessor::init]

[MultiFeatureProcessor::init]

Reimplemented from FeatureProcessor.

◆ Learn()

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

Reimplemented from FeatureProcessor.

◆ select_learn_matrix()

string MultiFeatureProcessor::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.

◆ update_req_features_vec()

void MultiFeatureProcessor::update_req_features_vec ( unordered_set< string > &  out_req_features,
unordered_set< string > &  in_req_features 
)
virtual

update sets of required as input according to set required as output to processor

Reimplemented from FeatureProcessor.


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