1#ifndef __FAIRNESS_POSTPROCESSOR_H__
2#define __FAIRNESS_POSTPROCESSOR_H__
13extern unordered_map<string, int> map_target_type;
14enum Fairness_Target_Type {
25 void set_type(
const string &t);
36 unordered_map<float, vector<float>> group_to_score_cutoffs_ranges;
37 unordered_map<float, vector<float>> group_to_factors;
38 unordered_map<float, vector<float>> group_to_bias;
39 bool feature_gen_init =
false;
67 int init(map<string, string> &mapper);
73 void dprint(
const string &pref)
const;
Logger.h - allowing logs with more control.
@ FTR_POSTPROCESS_FAIRNESS
"fairness_adjust" to adjust model calibrated predictions according to priors. Creates ProbAdjustPostP...
Definition PostProcessor.h:26
#define ADD_SERIALIZATION_FUNCS(...)
Definition SerializableObject.h:122
#define MEDSERIALIZE_SUPPORT(Type)
Definition SerializableObject.h:108
class that hold constrain that translate on reference group into raw score cutoff to measure fainess
Definition FairnessPostProcessor.h:20
float value
the value
Definition FairnessPostProcessor.h:23
Cutoff_Type type
constraint type
Definition FairnessPostProcessor.h:22
A post-processor to adjust probability to fairness between groups.
Definition FairnessPostProcessor.h:34
MedPidRepository * p_rep
required for building model for generating model (set by process)
Definition FairnessPostProcessor.h:53
int score_bin_count
how much bins for score. 0 means no binning
Definition FairnessPostProcessor.h:50
float score_resulotion
if >0 will apply score resulotion for speedup
Definition FairnessPostProcessor.h:51
float reference_group_val
the value for the feature used as refernce group for fairness
Definition FairnessPostProcessor.h:43
void parse_constrains(const string &s)
parses the constrains
Definition FairnessPostProcessor.cpp:27
MedModel group_feature_gen_model
model for generating features for priors (set in learn)
Definition FairnessPostProcessor.h:54
double allow_distance_cutoff_constraint
max distance allow between constraint
Definition FairnessPostProcessor.h:49
double allow_distance_target
max distance allow between target
Definition FairnessPostProcessor.h:48
vector< Cutoff_Constraint > constraints
list of constraints cutoffs. Init with comma seperated list for each constraint. The type is prefix w...
Definition FairnessPostProcessor.h:45
string feature_name
feautre name to search in matrix created by model_json to generate group for fairness
Definition FairnessPostProcessor.h:41
void Learn(const MedFeatures &matrix)
Learns from predictor and train_matrix (PostProcessor API)
Definition FairnessPostProcessor.cpp:227
int init(map< string, string > &mapper)
Global init for general args in all explainers.
Definition FairnessPostProcessor.cpp:48
double allow_distance_score
max distance allow between score
Definition FairnessPostProcessor.h:47
double resulotion
resulotion for target matching. effect speed/accuracy
Definition FairnessPostProcessor.h:46
string model_json
model json path - important for learn
Definition FairnessPostProcessor.h:42
string resolved_name
resolved feature name (value is set after learn)
Definition FairnessPostProcessor.h:55
void get_input_fields(vector< Effected_Field > &fields) const
List of fields that are used by this post_processor.
Definition FairnessPostProcessor.cpp:95
void get_output_fields(vector< Effected_Field > &fields) const
List of fields that are being effected by this post_processor.
Definition FairnessPostProcessor.cpp:98
Fairness_Target_Type fairness_target_type
fairness target - SENS of SPEC
Definition FairnessPostProcessor.h:44
A class for holding features data as a virtual matrix
Definition MedFeatures.h:47
A model = repCleaner + featureGenerator + featureProcessor + MedPredictor.
Definition MedModel.h:56
MedPidRepository * p_rep
not serialized. stores pointer to rep used in Learn or Apply after call.
Definition MedModel.h:302
Definition MedPidRepository.h:87
An Abstract PostProcessor class.
Definition PostProcessor.h:39
Definition SerializableObject.h:32