Exemplo n.º 1
0
 def test_CalibratedEqualOddsPostProcessing(self):
     self.post_processor = CalibratedEqualOddsPostProcessing()
     result = self.post_processor.post_process(
         self.validation_dataset, self.validation_dataset_with_predictions,
         self.testset_with_predictions, self.seed, self.privileged_groups,
         self.unprivileged_groups)
     self.assertEqual(self.post_processor.name(), 'calibrated_eq_odds')
     self.assertEqual(type(result), type(self.testset_with_predictions))
Exemplo n.º 2
0
seeds = [
    0xbeef, 0xcafe, 0xdead, 0xdeadcafe, 0xdeadbeef, 0xbeefcafe, 0xcafebeef, 50,
    583, 5278, 100000, 0xefac, 0xfeeb, 0xdaed, 0xefacdaed, 0xfeebdead
]
learners = [
    NonTunedLogisticRegression(),
    LogisticRegression(),
    NonTunedDecisionTree(),
    DecisionTree()
]
processors = [(NoPreProcessing(), NoPostProcessing()),
              (DIRemover(1.0), NoPostProcessing()),
              (DIRemover(0.5), NoPostProcessing()),
              (Reweighing(), NoPostProcessing()),
              (NoPreProcessing(), RejectOptionPostProcessing()),
              (NoPreProcessing(), CalibratedEqualOddsPostProcessing())]


def calculate_metrics(seed, learner, pre_processor, post_processor):
    '''
    Experiment function to run the experiments
    '''
    exp = GermanCreditDatasetSexExperiment(
        fixed_random_seed=seed,
        train_data_sampler=CompleteData(),
        missing_value_handler=CompleteCaseAnalysis(),
        numeric_attribute_scaler=NamedStandardScaler(),
        learners=[learner],
        pre_processors=[pre_processor],
        post_processors=[post_processor])
    exp.run()