From b5a5b1ee228be857158ebdcb21925a1384a45ad5 Mon Sep 17 00:00:00 2001 From: Denys Herasymuk Date: Tue, 3 Sep 2024 02:04:36 +0300 Subject: [PATCH] Added Python 3.8-3.12 to GitHub Actions --- ...ssifier_50_Estimators_20240423__010106.csv | 38 +++++++++---------- ...ression_50_Estimators_20240423__010106.csv | 38 +++++++++---------- ...ssifier_50_Estimators_20240902__220132.csv | 19 ++++++++++ ...ression_50_Estimators_20240902__220132.csv | 19 ++++++++++ tests/user_interfaces/conftest.py | 4 +- .../test_compute_model_metrics.py | 2 +- .../test_multiple_models_api.py | 12 ++++-- tests/utils/test_stability_utils.py | 2 +- virny/utils/stability_utils.py | 10 ++++- 9 files changed, 96 insertions(+), 48 deletions(-) rename tests/files_for_tests/law_school_dataset_20k/{ => python_3_11-}/Metrics_law_school_DecisionTreeClassifier_50_Estimators_20240423__010106.csv (87%) rename tests/files_for_tests/law_school_dataset_20k/{ => python_3_11-}/Metrics_law_school_LogisticRegression_50_Estimators_20240423__010106.csv (89%) create mode 100644 tests/files_for_tests/law_school_dataset_20k/python_3_12+/Metrics_law_school_DecisionTreeClassifier_50_Estimators_20240902__220132.csv create mode 100644 tests/files_for_tests/law_school_dataset_20k/python_3_12+/Metrics_law_school_LogisticRegression_50_Estimators_20240902__220132.csv diff --git a/tests/files_for_tests/law_school_dataset_20k/Metrics_law_school_DecisionTreeClassifier_50_Estimators_20240423__010106.csv b/tests/files_for_tests/law_school_dataset_20k/python_3_11-/Metrics_law_school_DecisionTreeClassifier_50_Estimators_20240423__010106.csv similarity index 87% rename from tests/files_for_tests/law_school_dataset_20k/Metrics_law_school_DecisionTreeClassifier_50_Estimators_20240423__010106.csv rename to tests/files_for_tests/law_school_dataset_20k/python_3_11-/Metrics_law_school_DecisionTreeClassifier_50_Estimators_20240423__010106.csv index 37b7e613..f443393f 100644 --- a/tests/files_for_tests/law_school_dataset_20k/Metrics_law_school_DecisionTreeClassifier_50_Estimators_20240423__010106.csv +++ b/tests/files_for_tests/law_school_dataset_20k/python_3_11-/Metrics_law_school_DecisionTreeClassifier_50_Estimators_20240423__010106.csv @@ -1,19 +1,19 @@ -Metric,overall,male_priv,male_dis,race_priv,race_dis,male&race_priv,male&race_dis,Model_Name,Model_Params,Virny_Random_State,Runtime_in_Mins -Statistical_Bias,0.14871459501539216,0.13922538692994388,0.1612539056997345,0.12087562594490028,0.3035414166913454,0.13498160237084172,0.3081005399506289,DecisionTreeClassifier,"{'ccp_alpha': 0.0, 'class_weight': None, 'criterion': 'gini', 'max_depth': 20, 'max_features': 0.6, 'max_leaf_nodes': None, 'min_impurity_decrease': 0.0, 'min_samples_leaf': 1, 'min_samples_split': 0.1, 'min_weight_fraction_leaf': 0.0, 'random_state': None, 'splitter': 'best'}",100,0.13008081666666665 -Std,0.041588229003281706,0.04014981475236609,0.04348899069199162,0.035707999117036614,0.07429121098892864,0.03859272201556965,0.0763542646485458,DecisionTreeClassifier,"{'ccp_alpha': 0.0, 'class_weight': None, 'criterion': 'gini', 'max_depth': 20, 'max_features': 0.6, 'max_leaf_nodes': None, 'min_impurity_decrease': 0.0, 'min_samples_leaf': 1, 'min_samples_split': 0.1, 'min_weight_fraction_leaf': 0.0, 'random_state': None, 'splitter': 'best'}",100,0.13008081666666665 -IQR,0.053505982148091664,0.05084500766436651,0.05702226985872847,0.044968952602027774,0.10098479315664254,0.049091273172528614,0.1047433620765962,DecisionTreeClassifier,"{'ccp_alpha': 0.0, 'class_weight': None, 'criterion': 'gini', 'max_depth': 20, 'max_features': 0.6, 'max_leaf_nodes': None, 'min_impurity_decrease': 0.0, 'min_samples_leaf': 1, 'min_samples_split': 0.1, 'min_weight_fraction_leaf': 0.0, 'random_state': None, 'splitter': 'best'}",100,0.13008081666666665 -Overall_Uncertainty,0.37102753012884837,0.35860883223592943,0.3874379523444912,0.3189445800260836,0.6606875964732465,0.3439739430925971,0.6850131008829163,DecisionTreeClassifier,"{'ccp_alpha': 0.0, 'class_weight': None, 'criterion': 'gini', 'max_depth': 20, 'max_features': 0.6, 'max_leaf_nodes': None, 'min_impurity_decrease': 0.0, 'min_samples_leaf': 1, 'min_samples_split': 0.1, 'min_weight_fraction_leaf': 0.0, 'random_state': None, 'splitter': 'best'}",100,0.13008081666666665 -Mean_Prediction,0.10730163589001154,0.10127383420207314,0.11526694526335872,0.08243941922626423,0.2455732067991173,0.0941339892140465,0.26012614125045447,DecisionTreeClassifier,"{'ccp_alpha': 0.0, 'class_weight': None, 'criterion': 'gini', 'max_depth': 20, 'max_features': 0.6, 'max_leaf_nodes': None, 'min_impurity_decrease': 0.0, 'min_samples_leaf': 1, 'min_samples_split': 0.1, 'min_weight_fraction_leaf': 0.0, 'random_state': None, 'splitter': 'best'}",100,0.13008081666666665 -Aleatoric_Uncertainty,0.35318189936459926,0.3413540927984995,0.368811500898374,0.3031037696893525,0.6316921284417605,0.3271516798716977,0.6552902043882751,DecisionTreeClassifier,"{'ccp_alpha': 0.0, 'class_weight': None, 'criterion': 'gini', 'max_depth': 20, 'max_features': 0.6, 'max_leaf_nodes': None, 'min_impurity_decrease': 0.0, 'min_samples_leaf': 1, 'min_samples_split': 0.1, 'min_weight_fraction_leaf': 0.0, 'random_state': None, 'splitter': 'best'}",100,0.13008081666666665 -Epistemic_Uncertainty,0.01784563076424911,0.017254739437429945,0.018626451446117187,0.015840810336731126,0.028995468031486005,0.016822263220899414,0.029722896494641216,DecisionTreeClassifier,"{'ccp_alpha': 0.0, 'class_weight': None, 'criterion': 'gini', 'max_depth': 20, 'max_features': 0.6, 'max_leaf_nodes': None, 'min_impurity_decrease': 0.0, 'min_samples_leaf': 1, 'min_samples_split': 0.1, 'min_weight_fraction_leaf': 0.0, 'random_state': None, 'splitter': 'best'}",100,0.13008081666666665 -Jitter,0.03490286499215079,0.027672021511307245,0.044457908163265336,0.013944459235764642,0.15146333612309273,0.023045132413278664,0.1725244279529997,DecisionTreeClassifier,"{'ccp_alpha': 0.0, 'class_weight': None, 'criterion': 'gini', 'max_depth': 20, 'max_features': 0.6, 'max_leaf_nodes': None, 'min_impurity_decrease': 0.0, 'min_samples_leaf': 1, 'min_samples_split': 0.1, 'min_weight_fraction_leaf': 0.0, 'random_state': None, 'splitter': 'best'}",100,0.13008081666666665 -Label_Stability,0.9493557692307693,0.9616385135135135,0.9331249999999999,0.9821100397050483,0.767192429022082,0.9684804177545692,0.7273939393939394,DecisionTreeClassifier,"{'ccp_alpha': 0.0, 'class_weight': None, 'criterion': 'gini', 'max_depth': 20, 'max_features': 0.6, 'max_leaf_nodes': None, 'min_impurity_decrease': 0.0, 'min_samples_leaf': 1, 'min_samples_split': 0.1, 'min_weight_fraction_leaf': 0.0, 'random_state': None, 'splitter': 'best'}",100,0.13008081666666665 -TPR,0.9959763948497854,0.9986046511627907,0.9923954372623575,1.0,0.967741935483871,0.9991389207807119,0.9508196721311475,DecisionTreeClassifier,"{'ccp_alpha': 0.0, 'class_weight': None, 'criterion': 'gini', 'max_depth': 20, 'max_features': 0.6, 'max_leaf_nodes': None, 'min_impurity_decrease': 0.0, 'min_samples_leaf': 1, 'min_samples_split': 0.1, 'min_weight_fraction_leaf': 0.0, 'random_state': None, 'splitter': 'best'}",100,0.13008081666666665 -TNR,0.1111111111111111,0.06880733944954129,0.1542056074766355,0.0,0.28402366863905326,0.04335260115606936,0.38372093023255816,DecisionTreeClassifier,"{'ccp_alpha': 0.0, 'class_weight': None, 'criterion': 'gini', 'max_depth': 20, 'max_features': 0.6, 'max_leaf_nodes': None, 'min_impurity_decrease': 0.0, 'min_samples_leaf': 1, 'min_samples_split': 0.1, 'min_weight_fraction_leaf': 0.0, 'random_state': None, 'splitter': 'best'}",100,0.13008081666666665 -PPV,0.9062728825970222,0.9136170212765957,0.8963938179736691,0.9254112308564946,0.7880910683012259,0.9131689401888772,0.8140350877192982,DecisionTreeClassifier,"{'ccp_alpha': 0.0, 'class_weight': None, 'criterion': 'gini', 'max_depth': 20, 'max_features': 0.6, 'max_leaf_nodes': None, 'min_impurity_decrease': 0.0, 'min_samples_leaf': 1, 'min_samples_split': 0.1, 'min_weight_fraction_leaf': 0.0, 'random_state': None, 'splitter': 'best'}",100,0.13008081666666665 -FNR,0.004023605150214592,0.0013953488372093023,0.0076045627376425855,0.0,0.03225806451612903,0.0008610792192881745,0.04918032786885246,DecisionTreeClassifier,"{'ccp_alpha': 0.0, 'class_weight': None, 'criterion': 'gini', 'max_depth': 20, 'max_features': 0.6, 'max_leaf_nodes': None, 'min_impurity_decrease': 0.0, 'min_samples_leaf': 1, 'min_samples_split': 0.1, 'min_weight_fraction_leaf': 0.0, 'random_state': None, 'splitter': 'best'}",100,0.13008081666666665 -FPR,0.8888888888888888,0.9311926605504587,0.8457943925233645,1.0,0.7159763313609467,0.9566473988439307,0.6162790697674418,DecisionTreeClassifier,"{'ccp_alpha': 0.0, 'class_weight': None, 'criterion': 'gini', 'max_depth': 20, 'max_features': 0.6, 'max_leaf_nodes': None, 'min_impurity_decrease': 0.0, 'min_samples_leaf': 1, 'min_samples_split': 0.1, 'min_weight_fraction_leaf': 0.0, 'random_state': None, 'splitter': 'best'}",100,0.13008081666666665 -Accuracy,0.9040865384615384,0.9130067567567568,0.8922991071428571,0.9254112308564946,0.7854889589905363,0.9127937336814621,0.803030303030303,DecisionTreeClassifier,"{'ccp_alpha': 0.0, 'class_weight': None, 'criterion': 'gini', 'max_depth': 20, 'max_features': 0.6, 'max_leaf_nodes': None, 'min_impurity_decrease': 0.0, 'min_samples_leaf': 1, 'min_samples_split': 0.1, 'min_weight_fraction_leaf': 0.0, 'random_state': None, 'splitter': 'best'}",100,0.13008081666666665 -F1,0.9490095846645368,0.9542222222222222,0.9419548872180451,0.9612608631609957,0.8687258687258688,0.9542214912280702,0.8771266540642723,DecisionTreeClassifier,"{'ccp_alpha': 0.0, 'class_weight': None, 'criterion': 'gini', 'max_depth': 20, 'max_features': 0.6, 'max_leaf_nodes': None, 'min_impurity_decrease': 0.0, 'min_samples_leaf': 1, 'min_samples_split': 0.1, 'min_weight_fraction_leaf': 0.0, 'random_state': None, 'splitter': 'best'}",100,0.13008081666666665 -Selection-Rate,0.9848557692307692,0.9923986486486487,0.9748883928571429,1.0,0.9006309148264984,0.9953002610966057,0.8636363636363636,DecisionTreeClassifier,"{'ccp_alpha': 0.0, 'class_weight': None, 'criterion': 'gini', 'max_depth': 20, 'max_features': 0.6, 'max_leaf_nodes': None, 'min_impurity_decrease': 0.0, 'min_samples_leaf': 1, 'min_samples_split': 0.1, 'min_weight_fraction_leaf': 0.0, 'random_state': None, 'splitter': 'best'}",100,0.13008081666666665 -Sample_Size,4160.0,2368.0,1792.0,3526.0,634.0,3830.0,330.0,DecisionTreeClassifier,"{'ccp_alpha': 0.0, 'class_weight': None, 'criterion': 'gini', 'max_depth': 20, 'max_features': 0.6, 'max_leaf_nodes': None, 'min_impurity_decrease': 0.0, 'min_samples_leaf': 1, 'min_samples_split': 0.1, 'min_weight_fraction_leaf': 0.0, 'random_state': None, 'splitter': 'best'}",100,0.13008081666666665 +Metric,overall,male_priv,male_dis,race_priv,race_dis,male&race_priv,male&race_dis,Model_Name,Model_Params,Virny_Random_State +Statistical_Bias,0.14871459501539216,0.13922538692994388,0.1612539056997345,0.12087562594490028,0.3035414166913454,0.13498160237084172,0.3081005399506289,DecisionTreeClassifier,"{'ccp_alpha': 0.0, 'class_weight': None, 'criterion': 'gini', 'max_depth': 20, 'max_features': 0.6, 'max_leaf_nodes': None, 'min_impurity_decrease': 0.0, 'min_samples_leaf': 1, 'min_samples_split': 0.1, 'min_weight_fraction_leaf': 0.0, 'random_state': None, 'splitter': 'best'}",100 +Std,0.041588229003281706,0.04014981475236609,0.04348899069199162,0.035707999117036614,0.07429121098892864,0.03859272201556965,0.0763542646485458,DecisionTreeClassifier,"{'ccp_alpha': 0.0, 'class_weight': None, 'criterion': 'gini', 'max_depth': 20, 'max_features': 0.6, 'max_leaf_nodes': None, 'min_impurity_decrease': 0.0, 'min_samples_leaf': 1, 'min_samples_split': 0.1, 'min_weight_fraction_leaf': 0.0, 'random_state': None, 'splitter': 'best'}",100 +IQR,0.053505982148091664,0.05084500766436651,0.05702226985872847,0.044968952602027774,0.10098479315664254,0.049091273172528614,0.1047433620765962,DecisionTreeClassifier,"{'ccp_alpha': 0.0, 'class_weight': None, 'criterion': 'gini', 'max_depth': 20, 'max_features': 0.6, 'max_leaf_nodes': None, 'min_impurity_decrease': 0.0, 'min_samples_leaf': 1, 'min_samples_split': 0.1, 'min_weight_fraction_leaf': 0.0, 'random_state': None, 'splitter': 'best'}",100 +Overall_Uncertainty,0.37102753012884837,0.35860883223592943,0.3874379523444912,0.3189445800260836,0.6606875964732465,0.3439739430925971,0.6850131008829163,DecisionTreeClassifier,"{'ccp_alpha': 0.0, 'class_weight': None, 'criterion': 'gini', 'max_depth': 20, 'max_features': 0.6, 'max_leaf_nodes': None, 'min_impurity_decrease': 0.0, 'min_samples_leaf': 1, 'min_samples_split': 0.1, 'min_weight_fraction_leaf': 0.0, 'random_state': None, 'splitter': 'best'}",100 +Mean_Prediction,0.10730163589001154,0.10127383420207314,0.11526694526335872,0.08243941922626423,0.2455732067991173,0.0941339892140465,0.26012614125045447,DecisionTreeClassifier,"{'ccp_alpha': 0.0, 'class_weight': None, 'criterion': 'gini', 'max_depth': 20, 'max_features': 0.6, 'max_leaf_nodes': None, 'min_impurity_decrease': 0.0, 'min_samples_leaf': 1, 'min_samples_split': 0.1, 'min_weight_fraction_leaf': 0.0, 'random_state': None, 'splitter': 'best'}",100 +Aleatoric_Uncertainty,0.35318189936459926,0.3413540927984995,0.368811500898374,0.3031037696893525,0.6316921284417605,0.3271516798716977,0.6552902043882751,DecisionTreeClassifier,"{'ccp_alpha': 0.0, 'class_weight': None, 'criterion': 'gini', 'max_depth': 20, 'max_features': 0.6, 'max_leaf_nodes': None, 'min_impurity_decrease': 0.0, 'min_samples_leaf': 1, 'min_samples_split': 0.1, 'min_weight_fraction_leaf': 0.0, 'random_state': None, 'splitter': 'best'}",100 +Epistemic_Uncertainty,0.01784563076424911,0.017254739437429945,0.018626451446117187,0.015840810336731126,0.028995468031486005,0.016822263220899414,0.029722896494641216,DecisionTreeClassifier,"{'ccp_alpha': 0.0, 'class_weight': None, 'criterion': 'gini', 'max_depth': 20, 'max_features': 0.6, 'max_leaf_nodes': None, 'min_impurity_decrease': 0.0, 'min_samples_leaf': 1, 'min_samples_split': 0.1, 'min_weight_fraction_leaf': 0.0, 'random_state': None, 'splitter': 'best'}",100 +Jitter,0.03490286499215079,0.027672021511307245,0.044457908163265336,0.013944459235764642,0.15146333612309273,0.023045132413278664,0.1725244279529997,DecisionTreeClassifier,"{'ccp_alpha': 0.0, 'class_weight': None, 'criterion': 'gini', 'max_depth': 20, 'max_features': 0.6, 'max_leaf_nodes': None, 'min_impurity_decrease': 0.0, 'min_samples_leaf': 1, 'min_samples_split': 0.1, 'min_weight_fraction_leaf': 0.0, 'random_state': None, 'splitter': 'best'}",100 +Label_Stability,0.9493557692307693,0.9616385135135135,0.9331249999999999,0.9821100397050483,0.767192429022082,0.9684804177545692,0.7273939393939394,DecisionTreeClassifier,"{'ccp_alpha': 0.0, 'class_weight': None, 'criterion': 'gini', 'max_depth': 20, 'max_features': 0.6, 'max_leaf_nodes': None, 'min_impurity_decrease': 0.0, 'min_samples_leaf': 1, 'min_samples_split': 0.1, 'min_weight_fraction_leaf': 0.0, 'random_state': None, 'splitter': 'best'}",100 +TPR,0.9959763948497854,0.9986046511627907,0.9923954372623575,1.0,0.967741935483871,0.9991389207807119,0.9508196721311475,DecisionTreeClassifier,"{'ccp_alpha': 0.0, 'class_weight': None, 'criterion': 'gini', 'max_depth': 20, 'max_features': 0.6, 'max_leaf_nodes': None, 'min_impurity_decrease': 0.0, 'min_samples_leaf': 1, 'min_samples_split': 0.1, 'min_weight_fraction_leaf': 0.0, 'random_state': None, 'splitter': 'best'}",100 +TNR,0.1111111111111111,0.06880733944954129,0.1542056074766355,0.0,0.28402366863905326,0.04335260115606936,0.38372093023255816,DecisionTreeClassifier,"{'ccp_alpha': 0.0, 'class_weight': None, 'criterion': 'gini', 'max_depth': 20, 'max_features': 0.6, 'max_leaf_nodes': None, 'min_impurity_decrease': 0.0, 'min_samples_leaf': 1, 'min_samples_split': 0.1, 'min_weight_fraction_leaf': 0.0, 'random_state': None, 'splitter': 'best'}",100 +PPV,0.9062728825970222,0.9136170212765957,0.8963938179736691,0.9254112308564946,0.7880910683012259,0.9131689401888772,0.8140350877192982,DecisionTreeClassifier,"{'ccp_alpha': 0.0, 'class_weight': None, 'criterion': 'gini', 'max_depth': 20, 'max_features': 0.6, 'max_leaf_nodes': None, 'min_impurity_decrease': 0.0, 'min_samples_leaf': 1, 'min_samples_split': 0.1, 'min_weight_fraction_leaf': 0.0, 'random_state': None, 'splitter': 'best'}",100 +FNR,0.004023605150214592,0.0013953488372093023,0.0076045627376425855,0.0,0.03225806451612903,0.0008610792192881745,0.04918032786885246,DecisionTreeClassifier,"{'ccp_alpha': 0.0, 'class_weight': None, 'criterion': 'gini', 'max_depth': 20, 'max_features': 0.6, 'max_leaf_nodes': None, 'min_impurity_decrease': 0.0, 'min_samples_leaf': 1, 'min_samples_split': 0.1, 'min_weight_fraction_leaf': 0.0, 'random_state': None, 'splitter': 'best'}",100 +FPR,0.8888888888888888,0.9311926605504587,0.8457943925233645,1.0,0.7159763313609467,0.9566473988439307,0.6162790697674418,DecisionTreeClassifier,"{'ccp_alpha': 0.0, 'class_weight': None, 'criterion': 'gini', 'max_depth': 20, 'max_features': 0.6, 'max_leaf_nodes': None, 'min_impurity_decrease': 0.0, 'min_samples_leaf': 1, 'min_samples_split': 0.1, 'min_weight_fraction_leaf': 0.0, 'random_state': None, 'splitter': 'best'}",100 +Accuracy,0.9040865384615384,0.9130067567567568,0.8922991071428571,0.9254112308564946,0.7854889589905363,0.9127937336814621,0.803030303030303,DecisionTreeClassifier,"{'ccp_alpha': 0.0, 'class_weight': None, 'criterion': 'gini', 'max_depth': 20, 'max_features': 0.6, 'max_leaf_nodes': None, 'min_impurity_decrease': 0.0, 'min_samples_leaf': 1, 'min_samples_split': 0.1, 'min_weight_fraction_leaf': 0.0, 'random_state': None, 'splitter': 'best'}",100 +F1,0.9490095846645368,0.9542222222222222,0.9419548872180451,0.9612608631609957,0.8687258687258688,0.9542214912280702,0.8771266540642723,DecisionTreeClassifier,"{'ccp_alpha': 0.0, 'class_weight': None, 'criterion': 'gini', 'max_depth': 20, 'max_features': 0.6, 'max_leaf_nodes': None, 'min_impurity_decrease': 0.0, 'min_samples_leaf': 1, 'min_samples_split': 0.1, 'min_weight_fraction_leaf': 0.0, 'random_state': None, 'splitter': 'best'}",100 +Selection-Rate,0.9848557692307692,0.9923986486486487,0.9748883928571429,1.0,0.9006309148264984,0.9953002610966057,0.8636363636363636,DecisionTreeClassifier,"{'ccp_alpha': 0.0, 'class_weight': None, 'criterion': 'gini', 'max_depth': 20, 'max_features': 0.6, 'max_leaf_nodes': None, 'min_impurity_decrease': 0.0, 'min_samples_leaf': 1, 'min_samples_split': 0.1, 'min_weight_fraction_leaf': 0.0, 'random_state': None, 'splitter': 'best'}",100 +Sample_Size,4160.0,2368.0,1792.0,3526.0,634.0,3830.0,330.0,DecisionTreeClassifier,"{'ccp_alpha': 0.0, 'class_weight': None, 'criterion': 'gini', 'max_depth': 20, 'max_features': 0.6, 'max_leaf_nodes': None, 'min_impurity_decrease': 0.0, 'min_samples_leaf': 1, 'min_samples_split': 0.1, 'min_weight_fraction_leaf': 0.0, 'random_state': None, 'splitter': 'best'}",100 diff --git a/tests/files_for_tests/law_school_dataset_20k/Metrics_law_school_LogisticRegression_50_Estimators_20240423__010106.csv b/tests/files_for_tests/law_school_dataset_20k/python_3_11-/Metrics_law_school_LogisticRegression_50_Estimators_20240423__010106.csv similarity index 89% rename from tests/files_for_tests/law_school_dataset_20k/Metrics_law_school_LogisticRegression_50_Estimators_20240423__010106.csv rename to tests/files_for_tests/law_school_dataset_20k/python_3_11-/Metrics_law_school_LogisticRegression_50_Estimators_20240423__010106.csv index c5a529f6..37c8c75b 100644 --- a/tests/files_for_tests/law_school_dataset_20k/Metrics_law_school_LogisticRegression_50_Estimators_20240423__010106.csv +++ b/tests/files_for_tests/law_school_dataset_20k/python_3_11-/Metrics_law_school_LogisticRegression_50_Estimators_20240423__010106.csv @@ -1,19 +1,19 @@ -Metric,overall,male_priv,male_dis,race_priv,race_dis,male&race_priv,male&race_dis,Model_Name,Model_Params,Virny_Random_State,Runtime_in_Mins -Statistical_Bias,0.13884987532256288,0.12866752312911567,0.15230512643533242,0.11307241003120876,0.28221161446659226,0.12620186366973807,0.28564346511140876,LogisticRegression,"{'C': 0.1, 'class_weight': None, 'dual': False, 'fit_intercept': True, 'intercept_scaling': 1, 'l1_ratio': None, 'max_iter': 250, 'multi_class': 'auto', 'n_jobs': None, 'penalty': 'l2', 'random_state': None, 'solver': 'lbfgs', 'tol': 0.0001, 'verbose': 0, 'warm_start': False}",100,0.18614128333333332 -Std,0.009171479431908339,0.008607050335232607,0.009917332166801268,0.007286748976075047,0.019653434616873924,0.008239377682865036,0.01998950882232001,LogisticRegression,"{'C': 0.1, 'class_weight': None, 'dual': False, 'fit_intercept': True, 'intercept_scaling': 1, 'l1_ratio': None, 'max_iter': 250, 'multi_class': 'auto', 'n_jobs': None, 'penalty': 'l2', 'random_state': None, 'solver': 'lbfgs', 'tol': 0.0001, 'verbose': 0, 'warm_start': False}",100,0.18614128333333332 -IQR,0.012256803023512921,0.011445377171906256,0.013329044327421729,0.009739371815749175,0.026257532421896154,0.010976514379596776,0.027115910618054847,LogisticRegression,"{'C': 0.1, 'class_weight': None, 'dual': False, 'fit_intercept': True, 'intercept_scaling': 1, 'l1_ratio': None, 'max_iter': 250, 'multi_class': 'auto', 'n_jobs': None, 'penalty': 'l2', 'random_state': None, 'solver': 'lbfgs', 'tol': 0.0001, 'verbose': 0, 'warm_start': False}",100,0.18614128333333332 -Overall_Uncertainty,0.342781514255694,0.3232951664439918,0.36853133100687174,0.2930493994499396,0.6193673767242902,0.3160946056979695,0.6525113923650412,LogisticRegression,"{'C': 0.1, 'class_weight': None, 'dual': False, 'fit_intercept': True, 'intercept_scaling': 1, 'l1_ratio': None, 'max_iter': 250, 'multi_class': 'auto', 'n_jobs': None, 'penalty': 'l2', 'random_state': None, 'solver': 'lbfgs', 'tol': 0.0001, 'verbose': 0, 'warm_start': False}",100,0.18614128333333332 -Mean_Prediction,0.10451562164193534,0.09389099362298176,0.11855530866698118,0.07598923254313926,0.2631655395636309,0.0885187447414513,0.2901763444566442,LogisticRegression,"{'C': 0.1, 'class_weight': None, 'dual': False, 'fit_intercept': True, 'intercept_scaling': 1, 'l1_ratio': None, 'max_iter': 250, 'multi_class': 'auto', 'n_jobs': None, 'penalty': 'l2', 'random_state': None, 'solver': 'lbfgs', 'tol': 0.0001, 'verbose': 0, 'warm_start': False}",100,0.18614128333333332 -Aleatoric_Uncertainty,0.34187256444643516,0.32243319534477255,0.36756030218791796,0.2923502561201371,0.6172915852012101,0.3152813861742673,0.6504913910597774,LogisticRegression,"{'C': 0.1, 'class_weight': None, 'dual': False, 'fit_intercept': True, 'intercept_scaling': 1, 'l1_ratio': None, 'max_iter': 250, 'multi_class': 'auto', 'n_jobs': None, 'penalty': 'l2', 'random_state': None, 'solver': 'lbfgs', 'tol': 0.0001, 'verbose': 0, 'warm_start': False}",100,0.18614128333333332 -Epistemic_Uncertainty,0.0009089498092588189,0.0008619710992192609,0.0009710288189537786,0.0006991433298024763,0.0020757915230801283,0.0008132195237021689,0.0020200013052638077,LogisticRegression,"{'C': 0.1, 'class_weight': None, 'dual': False, 'fit_intercept': True, 'intercept_scaling': 1, 'l1_ratio': None, 'max_iter': 250, 'multi_class': 'auto', 'n_jobs': None, 'penalty': 'l2', 'random_state': None, 'solver': 'lbfgs', 'tol': 0.0001, 'verbose': 0, 'warm_start': False}",100,0.18614128333333332 -Jitter,0.008828885400313994,0.007884376723662437,0.010076986151603502,0.005247780337319282,0.02874525204403535,0.006921084883039359,0.030970933828076638,LogisticRegression,"{'C': 0.1, 'class_weight': None, 'dual': False, 'fit_intercept': True, 'intercept_scaling': 1, 'l1_ratio': None, 'max_iter': 250, 'multi_class': 'auto', 'n_jobs': None, 'penalty': 'l2', 'random_state': None, 'solver': 'lbfgs', 'tol': 0.0001, 'verbose': 0, 'warm_start': False}",100,0.18614128333333332 -Label_Stability,0.9874423076923078,0.9889695945945947,0.9854241071428572,0.9924333522404991,0.9596845425867508,0.9902872062663186,0.9544242424242425,LogisticRegression,"{'C': 0.1, 'class_weight': None, 'dual': False, 'fit_intercept': True, 'intercept_scaling': 1, 'l1_ratio': None, 'max_iter': 250, 'multi_class': 'auto', 'n_jobs': None, 'penalty': 'l2', 'random_state': None, 'solver': 'lbfgs', 'tol': 0.0001, 'verbose': 0, 'warm_start': False}",100,0.18614128333333332 -TPR,0.9849785407725322,0.9897674418604652,0.9784537389100126,0.9947900704872816,0.9161290322580645,0.9913892078071183,0.8934426229508197,LogisticRegression,"{'C': 0.1, 'class_weight': None, 'dual': False, 'fit_intercept': True, 'intercept_scaling': 1, 'l1_ratio': None, 'max_iter': 250, 'multi_class': 'auto', 'n_jobs': None, 'penalty': 'l2', 'random_state': None, 'solver': 'lbfgs', 'tol': 0.0001, 'verbose': 0, 'warm_start': False}",100,0.18614128333333332 -TNR,0.24074074074074073,0.17889908256880735,0.3037383177570093,0.11787072243346007,0.4319526627218935,0.16473988439306358,0.5465116279069767,LogisticRegression,"{'C': 0.1, 'class_weight': None, 'dual': False, 'fit_intercept': True, 'intercept_scaling': 1, 'l1_ratio': None, 'max_iter': 250, 'multi_class': 'auto', 'n_jobs': None, 'penalty': 'l2', 'random_state': None, 'solver': 'lbfgs', 'tol': 0.0001, 'verbose': 0, 'warm_start': False}",100,0.18614128333333332 -PPV,0.918,0.9224100563502384,0.9119905493207324,0.9332949971247844,0.8160919540229885,0.9227892065188351,0.8482490272373541,LogisticRegression,"{'C': 0.1, 'class_weight': None, 'dual': False, 'fit_intercept': True, 'intercept_scaling': 1, 'l1_ratio': None, 'max_iter': 250, 'multi_class': 'auto', 'n_jobs': None, 'penalty': 'l2', 'random_state': None, 'solver': 'lbfgs', 'tol': 0.0001, 'verbose': 0, 'warm_start': False}",100,0.18614128333333332 -FNR,0.015021459227467811,0.010232558139534883,0.021546261089987327,0.005209929512718358,0.08387096774193549,0.008610792192881744,0.10655737704918032,LogisticRegression,"{'C': 0.1, 'class_weight': None, 'dual': False, 'fit_intercept': True, 'intercept_scaling': 1, 'l1_ratio': None, 'max_iter': 250, 'multi_class': 'auto', 'n_jobs': None, 'penalty': 'l2', 'random_state': None, 'solver': 'lbfgs', 'tol': 0.0001, 'verbose': 0, 'warm_start': False}",100,0.18614128333333332 -FPR,0.7592592592592593,0.8211009174311926,0.6962616822429907,0.8821292775665399,0.5680473372781065,0.8352601156069365,0.45348837209302323,LogisticRegression,"{'C': 0.1, 'class_weight': None, 'dual': False, 'fit_intercept': True, 'intercept_scaling': 1, 'l1_ratio': None, 'max_iter': 250, 'multi_class': 'auto', 'n_jobs': None, 'penalty': 'l2', 'random_state': None, 'solver': 'lbfgs', 'tol': 0.0001, 'verbose': 0, 'warm_start': False}",100,0.18614128333333332 -Accuracy,0.9076923076923077,0.9151182432432432,0.8978794642857143,0.9293817356778219,0.7870662460567823,0.9167101827676241,0.803030303030303,LogisticRegression,"{'C': 0.1, 'class_weight': None, 'dual': False, 'fit_intercept': True, 'intercept_scaling': 1, 'l1_ratio': None, 'max_iter': 250, 'multi_class': 'auto', 'n_jobs': None, 'penalty': 'l2', 'random_state': None, 'solver': 'lbfgs', 'tol': 0.0001, 'verbose': 0, 'warm_start': False}",100,0.18614128333333332 -F1,0.9503105590062112,0.9549024007179717,0.9440538061754815,0.9630618602581219,0.8632218844984803,0.9558599695585996,0.8702594810379242,LogisticRegression,"{'C': 0.1, 'class_weight': None, 'dual': False, 'fit_intercept': True, 'intercept_scaling': 1, 'l1_ratio': None, 'max_iter': 250, 'multi_class': 'auto', 'n_jobs': None, 'penalty': 'l2', 'random_state': None, 'solver': 'lbfgs', 'tol': 0.0001, 'verbose': 0, 'warm_start': False}",100,0.18614128333333332 -Selection-Rate,0.9615384615384616,0.9742398648648649,0.9447544642857143,0.9863868406125922,0.8233438485804416,0.9772845953002611,0.7787878787878788,LogisticRegression,"{'C': 0.1, 'class_weight': None, 'dual': False, 'fit_intercept': True, 'intercept_scaling': 1, 'l1_ratio': None, 'max_iter': 250, 'multi_class': 'auto', 'n_jobs': None, 'penalty': 'l2', 'random_state': None, 'solver': 'lbfgs', 'tol': 0.0001, 'verbose': 0, 'warm_start': False}",100,0.18614128333333332 -Sample_Size,4160.0,2368.0,1792.0,3526.0,634.0,3830.0,330.0,LogisticRegression,"{'C': 0.1, 'class_weight': None, 'dual': False, 'fit_intercept': True, 'intercept_scaling': 1, 'l1_ratio': None, 'max_iter': 250, 'multi_class': 'auto', 'n_jobs': None, 'penalty': 'l2', 'random_state': None, 'solver': 'lbfgs', 'tol': 0.0001, 'verbose': 0, 'warm_start': False}",100,0.18614128333333332 +Metric,overall,male_priv,male_dis,race_priv,race_dis,male&race_priv,male&race_dis,Model_Name,Model_Params,Virny_Random_State +Statistical_Bias,0.13884987532256288,0.12866752312911567,0.15230512643533242,0.11307241003120876,0.28221161446659226,0.12620186366973807,0.28564346511140876,LogisticRegression,"{'C': 0.1, 'class_weight': None, 'dual': False, 'fit_intercept': True, 'intercept_scaling': 1, 'l1_ratio': None, 'max_iter': 250, 'multi_class': 'auto', 'n_jobs': None, 'penalty': 'l2', 'random_state': None, 'solver': 'lbfgs', 'tol': 0.0001, 'verbose': 0, 'warm_start': False}",100 +Std,0.009171479431908339,0.008607050335232607,0.009917332166801268,0.007286748976075047,0.019653434616873924,0.008239377682865036,0.01998950882232001,LogisticRegression,"{'C': 0.1, 'class_weight': None, 'dual': False, 'fit_intercept': True, 'intercept_scaling': 1, 'l1_ratio': None, 'max_iter': 250, 'multi_class': 'auto', 'n_jobs': None, 'penalty': 'l2', 'random_state': None, 'solver': 'lbfgs', 'tol': 0.0001, 'verbose': 0, 'warm_start': False}",100 +IQR,0.012256803023512921,0.011445377171906256,0.013329044327421729,0.009739371815749175,0.026257532421896154,0.010976514379596776,0.027115910618054847,LogisticRegression,"{'C': 0.1, 'class_weight': None, 'dual': False, 'fit_intercept': True, 'intercept_scaling': 1, 'l1_ratio': None, 'max_iter': 250, 'multi_class': 'auto', 'n_jobs': None, 'penalty': 'l2', 'random_state': None, 'solver': 'lbfgs', 'tol': 0.0001, 'verbose': 0, 'warm_start': False}",100 +Overall_Uncertainty,0.342781514255694,0.3232951664439918,0.36853133100687174,0.2930493994499396,0.6193673767242902,0.3160946056979695,0.6525113923650412,LogisticRegression,"{'C': 0.1, 'class_weight': None, 'dual': False, 'fit_intercept': True, 'intercept_scaling': 1, 'l1_ratio': None, 'max_iter': 250, 'multi_class': 'auto', 'n_jobs': None, 'penalty': 'l2', 'random_state': None, 'solver': 'lbfgs', 'tol': 0.0001, 'verbose': 0, 'warm_start': False}",100 +Mean_Prediction,0.10451562164193534,0.09389099362298176,0.11855530866698118,0.07598923254313926,0.2631655395636309,0.0885187447414513,0.2901763444566442,LogisticRegression,"{'C': 0.1, 'class_weight': None, 'dual': False, 'fit_intercept': True, 'intercept_scaling': 1, 'l1_ratio': None, 'max_iter': 250, 'multi_class': 'auto', 'n_jobs': None, 'penalty': 'l2', 'random_state': None, 'solver': 'lbfgs', 'tol': 0.0001, 'verbose': 0, 'warm_start': False}",100 +Aleatoric_Uncertainty,0.34187256444643516,0.32243319534477255,0.36756030218791796,0.2923502561201371,0.6172915852012101,0.3152813861742673,0.6504913910597774,LogisticRegression,"{'C': 0.1, 'class_weight': None, 'dual': False, 'fit_intercept': True, 'intercept_scaling': 1, 'l1_ratio': None, 'max_iter': 250, 'multi_class': 'auto', 'n_jobs': None, 'penalty': 'l2', 'random_state': None, 'solver': 'lbfgs', 'tol': 0.0001, 'verbose': 0, 'warm_start': False}",100 +Epistemic_Uncertainty,0.0009089498092588189,0.0008619710992192609,0.0009710288189537786,0.0006991433298024763,0.0020757915230801283,0.0008132195237021689,0.0020200013052638077,LogisticRegression,"{'C': 0.1, 'class_weight': None, 'dual': False, 'fit_intercept': True, 'intercept_scaling': 1, 'l1_ratio': None, 'max_iter': 250, 'multi_class': 'auto', 'n_jobs': None, 'penalty': 'l2', 'random_state': None, 'solver': 'lbfgs', 'tol': 0.0001, 'verbose': 0, 'warm_start': False}",100 +Jitter,0.008828885400313994,0.007884376723662437,0.010076986151603502,0.005247780337319282,0.02874525204403535,0.006921084883039359,0.030970933828076638,LogisticRegression,"{'C': 0.1, 'class_weight': None, 'dual': False, 'fit_intercept': True, 'intercept_scaling': 1, 'l1_ratio': None, 'max_iter': 250, 'multi_class': 'auto', 'n_jobs': None, 'penalty': 'l2', 'random_state': None, 'solver': 'lbfgs', 'tol': 0.0001, 'verbose': 0, 'warm_start': False}",100 +Label_Stability,0.9874423076923078,0.9889695945945947,0.9854241071428572,0.9924333522404991,0.9596845425867508,0.9902872062663186,0.9544242424242425,LogisticRegression,"{'C': 0.1, 'class_weight': None, 'dual': False, 'fit_intercept': True, 'intercept_scaling': 1, 'l1_ratio': None, 'max_iter': 250, 'multi_class': 'auto', 'n_jobs': None, 'penalty': 'l2', 'random_state': None, 'solver': 'lbfgs', 'tol': 0.0001, 'verbose': 0, 'warm_start': False}",100 +TPR,0.9849785407725322,0.9897674418604652,0.9784537389100126,0.9947900704872816,0.9161290322580645,0.9913892078071183,0.8934426229508197,LogisticRegression,"{'C': 0.1, 'class_weight': None, 'dual': False, 'fit_intercept': True, 'intercept_scaling': 1, 'l1_ratio': None, 'max_iter': 250, 'multi_class': 'auto', 'n_jobs': None, 'penalty': 'l2', 'random_state': None, 'solver': 'lbfgs', 'tol': 0.0001, 'verbose': 0, 'warm_start': False}",100 +TNR,0.24074074074074073,0.17889908256880735,0.3037383177570093,0.11787072243346007,0.4319526627218935,0.16473988439306358,0.5465116279069767,LogisticRegression,"{'C': 0.1, 'class_weight': None, 'dual': False, 'fit_intercept': True, 'intercept_scaling': 1, 'l1_ratio': None, 'max_iter': 250, 'multi_class': 'auto', 'n_jobs': None, 'penalty': 'l2', 'random_state': None, 'solver': 'lbfgs', 'tol': 0.0001, 'verbose': 0, 'warm_start': False}",100 +PPV,0.918,0.9224100563502384,0.9119905493207324,0.9332949971247844,0.8160919540229885,0.9227892065188351,0.8482490272373541,LogisticRegression,"{'C': 0.1, 'class_weight': None, 'dual': False, 'fit_intercept': True, 'intercept_scaling': 1, 'l1_ratio': None, 'max_iter': 250, 'multi_class': 'auto', 'n_jobs': None, 'penalty': 'l2', 'random_state': None, 'solver': 'lbfgs', 'tol': 0.0001, 'verbose': 0, 'warm_start': False}",100 +FNR,0.015021459227467811,0.010232558139534883,0.021546261089987327,0.005209929512718358,0.08387096774193549,0.008610792192881744,0.10655737704918032,LogisticRegression,"{'C': 0.1, 'class_weight': None, 'dual': False, 'fit_intercept': True, 'intercept_scaling': 1, 'l1_ratio': None, 'max_iter': 250, 'multi_class': 'auto', 'n_jobs': None, 'penalty': 'l2', 'random_state': None, 'solver': 'lbfgs', 'tol': 0.0001, 'verbose': 0, 'warm_start': False}",100 +FPR,0.7592592592592593,0.8211009174311926,0.6962616822429907,0.8821292775665399,0.5680473372781065,0.8352601156069365,0.45348837209302323,LogisticRegression,"{'C': 0.1, 'class_weight': None, 'dual': False, 'fit_intercept': True, 'intercept_scaling': 1, 'l1_ratio': None, 'max_iter': 250, 'multi_class': 'auto', 'n_jobs': None, 'penalty': 'l2', 'random_state': None, 'solver': 'lbfgs', 'tol': 0.0001, 'verbose': 0, 'warm_start': False}",100 +Accuracy,0.9076923076923077,0.9151182432432432,0.8978794642857143,0.9293817356778219,0.7870662460567823,0.9167101827676241,0.803030303030303,LogisticRegression,"{'C': 0.1, 'class_weight': None, 'dual': False, 'fit_intercept': True, 'intercept_scaling': 1, 'l1_ratio': None, 'max_iter': 250, 'multi_class': 'auto', 'n_jobs': None, 'penalty': 'l2', 'random_state': None, 'solver': 'lbfgs', 'tol': 0.0001, 'verbose': 0, 'warm_start': False}",100 +F1,0.9503105590062112,0.9549024007179717,0.9440538061754815,0.9630618602581219,0.8632218844984803,0.9558599695585996,0.8702594810379242,LogisticRegression,"{'C': 0.1, 'class_weight': None, 'dual': False, 'fit_intercept': True, 'intercept_scaling': 1, 'l1_ratio': None, 'max_iter': 250, 'multi_class': 'auto', 'n_jobs': None, 'penalty': 'l2', 'random_state': None, 'solver': 'lbfgs', 'tol': 0.0001, 'verbose': 0, 'warm_start': False}",100 +Selection-Rate,0.9615384615384616,0.9742398648648649,0.9447544642857143,0.9863868406125922,0.8233438485804416,0.9772845953002611,0.7787878787878788,LogisticRegression,"{'C': 0.1, 'class_weight': None, 'dual': False, 'fit_intercept': True, 'intercept_scaling': 1, 'l1_ratio': None, 'max_iter': 250, 'multi_class': 'auto', 'n_jobs': None, 'penalty': 'l2', 'random_state': None, 'solver': 'lbfgs', 'tol': 0.0001, 'verbose': 0, 'warm_start': False}",100 +Sample_Size,4160.0,2368.0,1792.0,3526.0,634.0,3830.0,330.0,LogisticRegression,"{'C': 0.1, 'class_weight': None, 'dual': False, 'fit_intercept': True, 'intercept_scaling': 1, 'l1_ratio': None, 'max_iter': 250, 'multi_class': 'auto', 'n_jobs': None, 'penalty': 'l2', 'random_state': None, 'solver': 'lbfgs', 'tol': 0.0001, 'verbose': 0, 'warm_start': False}",100 diff --git a/tests/files_for_tests/law_school_dataset_20k/python_3_12+/Metrics_law_school_DecisionTreeClassifier_50_Estimators_20240902__220132.csv b/tests/files_for_tests/law_school_dataset_20k/python_3_12+/Metrics_law_school_DecisionTreeClassifier_50_Estimators_20240902__220132.csv new file mode 100644 index 00000000..c1e70a48 --- /dev/null +++ b/tests/files_for_tests/law_school_dataset_20k/python_3_12+/Metrics_law_school_DecisionTreeClassifier_50_Estimators_20240902__220132.csv @@ -0,0 +1,19 @@ +Metric,overall,male_priv,male_dis,race_priv,race_dis,male&race_priv,male&race_dis,Model_Name,Model_Params,Virny_Random_State +IQR,0.05433679704393761,0.05185732764374271,0.057613238751338024,0.04526554347776688,0.10478670252393446,0.04957708403463801,0.10957831469732389,DecisionTreeClassifier,"{'ccp_alpha': 0.0, 'class_weight': None, 'criterion': 'gini', 'max_depth': 20, 'max_features': 0.6, 'max_leaf_nodes': None, 'min_impurity_decrease': 0.0, 'min_samples_leaf': 1, 'min_samples_split': 0.1, 'min_weight_fraction_leaf': 0.0, 'monotonic_cst': None, 'random_state': None, 'splitter': 'best'}",100 +Statistical_Bias,0.1485460477889447,0.13885191650835318,0.16135614983829774,0.1206959795622374,0.3034345975797488,0.13474825022045164,0.3086841225990307,DecisionTreeClassifier,"{'ccp_alpha': 0.0, 'class_weight': None, 'criterion': 'gini', 'max_depth': 20, 'max_features': 0.6, 'max_leaf_nodes': None, 'min_impurity_decrease': 0.0, 'min_samples_leaf': 1, 'min_samples_split': 0.1, 'min_weight_fraction_leaf': 0.0, 'monotonic_cst': None, 'random_state': None, 'splitter': 'best'}",100 +Aleatoric_Uncertainty,0.35278605356537523,0.34062679761658954,0.36885364178341346,0.3026598740384362,0.6315635125748185,0.3267062604357122,0.6554697132217671,DecisionTreeClassifier,"{'ccp_alpha': 0.0, 'class_weight': None, 'criterion': 'gini', 'max_depth': 20, 'max_features': 0.6, 'max_leaf_nodes': None, 'min_impurity_decrease': 0.0, 'min_samples_leaf': 1, 'min_samples_split': 0.1, 'min_weight_fraction_leaf': 0.0, 'monotonic_cst': None, 'random_state': None, 'splitter': 'best'}",100 +Std,0.042595752935374216,0.04106432732527748,0.044619422491573475,0.03640805289375485,0.07700873455485355,0.0394433034815967,0.07918327235345879,DecisionTreeClassifier,"{'ccp_alpha': 0.0, 'class_weight': None, 'criterion': 'gini', 'max_depth': 20, 'max_features': 0.6, 'max_leaf_nodes': None, 'min_impurity_decrease': 0.0, 'min_samples_leaf': 1, 'min_samples_split': 0.1, 'min_weight_fraction_leaf': 0.0, 'monotonic_cst': None, 'random_state': None, 'splitter': 'best'}",100 +Mean_Prediction,0.10689943863572628,0.10067674363641255,0.11512228559910512,0.08190956920555666,0.2458809522173952,0.09366054591035684,0.2605508299634987,DecisionTreeClassifier,"{'ccp_alpha': 0.0, 'class_weight': None, 'criterion': 'gini', 'max_depth': 20, 'max_features': 0.6, 'max_leaf_nodes': None, 'min_impurity_decrease': 0.0, 'min_samples_leaf': 1, 'min_samples_split': 0.1, 'min_weight_fraction_leaf': 0.0, 'monotonic_cst': None, 'random_state': None, 'splitter': 'best'}",100 +Overall_Uncertainty,0.37117830444850247,0.3583978297342497,0.3880667888923365,0.31890438077568595,0.661900473013725,0.34400681382809695,0.6865322713459363,DecisionTreeClassifier,"{'ccp_alpha': 0.0, 'class_weight': None, 'criterion': 'gini', 'max_depth': 20, 'max_features': 0.6, 'max_leaf_nodes': None, 'min_impurity_decrease': 0.0, 'min_samples_leaf': 1, 'min_samples_split': 0.1, 'min_weight_fraction_leaf': 0.0, 'monotonic_cst': None, 'random_state': None, 'splitter': 'best'}",100 +Epistemic_Uncertainty,0.018392250883127237,0.01777103211766018,0.019213147108923023,0.016244506737249753,0.030336960438906546,0.017300553392384732,0.03106255812416925,DecisionTreeClassifier,"{'ccp_alpha': 0.0, 'class_weight': None, 'criterion': 'gini', 'max_depth': 20, 'max_features': 0.6, 'max_leaf_nodes': None, 'min_impurity_decrease': 0.0, 'min_samples_leaf': 1, 'min_samples_split': 0.1, 'min_weight_fraction_leaf': 0.0, 'monotonic_cst': None, 'random_state': None, 'splitter': 'best'}",100 +Jitter,0.038216444270015665,0.030332666850524003,0.04863429300291543,0.01557618623172467,0.16413056074164717,0.02552373847711407,0.1855287569573283,DecisionTreeClassifier,"{'ccp_alpha': 0.0, 'class_weight': None, 'criterion': 'gini', 'max_depth': 20, 'max_features': 0.6, 'max_leaf_nodes': None, 'min_impurity_decrease': 0.0, 'min_samples_leaf': 1, 'min_samples_split': 0.1, 'min_weight_fraction_leaf': 0.0, 'monotonic_cst': None, 'random_state': None, 'splitter': 'best'}",100 +Label_Stability,0.9436057692307692,0.9566385135135134,0.9263839285714285,0.9787067498581963,0.748391167192429,0.9637493472584856,0.7098181818181818,DecisionTreeClassifier,"{'ccp_alpha': 0.0, 'class_weight': None, 'criterion': 'gini', 'max_depth': 20, 'max_features': 0.6, 'max_leaf_nodes': None, 'min_impurity_decrease': 0.0, 'min_samples_leaf': 1, 'min_samples_split': 0.1, 'min_weight_fraction_leaf': 0.0, 'monotonic_cst': None, 'random_state': None, 'splitter': 'best'}",100 +TPR,0.9957081545064378,0.998139534883721,0.9923954372623575,1.0,0.9655913978494624,0.9988518943742825,0.9508196721311475,DecisionTreeClassifier,"{'ccp_alpha': 0.0, 'class_weight': None, 'criterion': 'gini', 'max_depth': 20, 'max_features': 0.6, 'max_leaf_nodes': None, 'min_impurity_decrease': 0.0, 'min_samples_leaf': 1, 'min_samples_split': 0.1, 'min_weight_fraction_leaf': 0.0, 'monotonic_cst': None, 'random_state': None, 'splitter': 'best'}",100 +TNR,0.125,0.0779816513761468,0.17289719626168223,0.026615969581749048,0.2781065088757396,0.06069364161849711,0.38372093023255816,DecisionTreeClassifier,"{'ccp_alpha': 0.0, 'class_weight': None, 'criterion': 'gini', 'max_depth': 20, 'max_features': 0.6, 'max_leaf_nodes': None, 'min_impurity_decrease': 0.0, 'min_samples_leaf': 1, 'min_samples_split': 0.1, 'min_weight_fraction_leaf': 0.0, 'monotonic_cst': None, 'random_state': None, 'splitter': 'best'}",100 +PPV,0.9075794621026895,0.9143587558585429,0.8984509466437177,0.9272520602443876,0.7863397548161121,0.9145860709592641,0.8140350877192982,DecisionTreeClassifier,"{'ccp_alpha': 0.0, 'class_weight': None, 'criterion': 'gini', 'max_depth': 20, 'max_features': 0.6, 'max_leaf_nodes': None, 'min_impurity_decrease': 0.0, 'min_samples_leaf': 1, 'min_samples_split': 0.1, 'min_weight_fraction_leaf': 0.0, 'monotonic_cst': None, 'random_state': None, 'splitter': 'best'}",100 +FNR,0.004291845493562232,0.0018604651162790699,0.0076045627376425855,0.0,0.034408602150537634,0.001148105625717566,0.04918032786885246,DecisionTreeClassifier,"{'ccp_alpha': 0.0, 'class_weight': None, 'criterion': 'gini', 'max_depth': 20, 'max_features': 0.6, 'max_leaf_nodes': None, 'min_impurity_decrease': 0.0, 'min_samples_leaf': 1, 'min_samples_split': 0.1, 'min_weight_fraction_leaf': 0.0, 'monotonic_cst': None, 'random_state': None, 'splitter': 'best'}",100 +FPR,0.875,0.9220183486238532,0.8271028037383178,0.973384030418251,0.7218934911242604,0.9393063583815029,0.6162790697674418,DecisionTreeClassifier,"{'ccp_alpha': 0.0, 'class_weight': None, 'criterion': 'gini', 'max_depth': 20, 'max_features': 0.6, 'max_leaf_nodes': None, 'min_impurity_decrease': 0.0, 'min_samples_leaf': 1, 'min_samples_split': 0.1, 'min_weight_fraction_leaf': 0.0, 'monotonic_cst': None, 'random_state': None, 'splitter': 'best'}",100 +Accuracy,0.9052884615384615,0.9134290540540541,0.89453125,0.9273964832671583,0.7823343848580442,0.9140992167101828,0.803030303030303,DecisionTreeClassifier,"{'ccp_alpha': 0.0, 'class_weight': None, 'criterion': 'gini', 'max_depth': 20, 'max_features': 0.6, 'max_leaf_nodes': None, 'min_impurity_decrease': 0.0, 'min_samples_leaf': 1, 'min_samples_split': 0.1, 'min_weight_fraction_leaf': 0.0, 'monotonic_cst': None, 'random_state': None, 'splitter': 'best'}",100 +F1,0.9496034791506779,0.9544140538136535,0.943089430894309,0.9622530227071661,0.8667953667953668,0.954863492934559,0.8771266540642723,DecisionTreeClassifier,"{'ccp_alpha': 0.0, 'class_weight': None, 'criterion': 'gini', 'max_depth': 20, 'max_features': 0.6, 'max_leaf_nodes': None, 'min_impurity_decrease': 0.0, 'min_samples_leaf': 1, 'min_samples_split': 0.1, 'min_weight_fraction_leaf': 0.0, 'monotonic_cst': None, 'random_state': None, 'splitter': 'best'}",100 +Selection-Rate,0.9831730769230769,0.9911317567567568,0.97265625,0.9980147475893364,0.9006309148264984,0.9934725848563969,0.8636363636363636,DecisionTreeClassifier,"{'ccp_alpha': 0.0, 'class_weight': None, 'criterion': 'gini', 'max_depth': 20, 'max_features': 0.6, 'max_leaf_nodes': None, 'min_impurity_decrease': 0.0, 'min_samples_leaf': 1, 'min_samples_split': 0.1, 'min_weight_fraction_leaf': 0.0, 'monotonic_cst': None, 'random_state': None, 'splitter': 'best'}",100 +Sample_Size,4160.0,2368.0,1792.0,3526.0,634.0,3830.0,330.0,DecisionTreeClassifier,"{'ccp_alpha': 0.0, 'class_weight': None, 'criterion': 'gini', 'max_depth': 20, 'max_features': 0.6, 'max_leaf_nodes': None, 'min_impurity_decrease': 0.0, 'min_samples_leaf': 1, 'min_samples_split': 0.1, 'min_weight_fraction_leaf': 0.0, 'monotonic_cst': None, 'random_state': None, 'splitter': 'best'}",100 diff --git a/tests/files_for_tests/law_school_dataset_20k/python_3_12+/Metrics_law_school_LogisticRegression_50_Estimators_20240902__220132.csv b/tests/files_for_tests/law_school_dataset_20k/python_3_12+/Metrics_law_school_LogisticRegression_50_Estimators_20240902__220132.csv new file mode 100644 index 00000000..e9c9b3ae --- /dev/null +++ b/tests/files_for_tests/law_school_dataset_20k/python_3_12+/Metrics_law_school_LogisticRegression_50_Estimators_20240902__220132.csv @@ -0,0 +1,19 @@ +Metric,overall,male_priv,male_dis,race_priv,race_dis,male&race_priv,male&race_dis,Model_Name,Model_Params,Virny_Random_State +IQR,0.011419687394194309,0.010451263586665198,0.012699390282714922,0.00892175766969869,0.025311959016546925,0.01007916110640982,0.026977916734238525,LogisticRegression,"{'C': 0.1, 'class_weight': None, 'dual': False, 'fit_intercept': True, 'intercept_scaling': 1, 'l1_ratio': None, 'max_iter': 250, 'multi_class': 'deprecated', 'n_jobs': None, 'penalty': 'l2', 'random_state': None, 'solver': 'lbfgs', 'tol': 0.0001, 'verbose': 0, 'warm_start': False}",100 +Statistical_Bias,0.1387144798061811,0.12815170690399935,0.15267242971263548,0.11277299821420668,0.2829883979344173,0.12593001168137175,0.28709179167896826,LogisticRegression,"{'C': 0.1, 'class_weight': None, 'dual': False, 'fit_intercept': True, 'intercept_scaling': 1, 'l1_ratio': None, 'max_iter': 250, 'multi_class': 'deprecated', 'n_jobs': None, 'penalty': 'l2', 'random_state': None, 'solver': 'lbfgs', 'tol': 0.0001, 'verbose': 0, 'warm_start': False}",100 +Aleatoric_Uncertainty,0.3414549629607785,0.3208370984275454,0.36869999823683636,0.2914392664783241,0.6196179689499488,0.3145254227683469,0.6540008385274846,LogisticRegression,"{'C': 0.1, 'class_weight': None, 'dual': False, 'fit_intercept': True, 'intercept_scaling': 1, 'l1_ratio': None, 'max_iter': 250, 'multi_class': 'deprecated', 'n_jobs': None, 'penalty': 'l2', 'random_state': None, 'solver': 'lbfgs', 'tol': 0.0001, 'verbose': 0, 'warm_start': False}",100 +Std,0.008657704312113908,0.007928013182409438,0.009621939019223385,0.006777265759583952,0.01911579001593193,0.007650000770777627,0.020353172685804687,LogisticRegression,"{'C': 0.1, 'class_weight': None, 'dual': False, 'fit_intercept': True, 'intercept_scaling': 1, 'l1_ratio': None, 'max_iter': 250, 'multi_class': 'deprecated', 'n_jobs': None, 'penalty': 'l2', 'random_state': None, 'solver': 'lbfgs', 'tol': 0.0001, 'verbose': 0, 'warm_start': False}",100 +Mean_Prediction,0.10412864589848997,0.09288075207051188,0.11899193417117529,0.07532233971872429,0.26433532663958426,0.08787924754695121,0.2927201479784701,LogisticRegression,"{'C': 0.1, 'class_weight': None, 'dual': False, 'fit_intercept': True, 'intercept_scaling': 1, 'l1_ratio': None, 'max_iter': 250, 'multi_class': 'deprecated', 'n_jobs': None, 'penalty': 'l2', 'random_state': None, 'solver': 'lbfgs', 'tol': 0.0001, 'verbose': 0, 'warm_start': False}",100 +Overall_Uncertainty,0.34226152607880284,0.32156453380265854,0.36961112301513627,0.29204344135573435,0.6215501171411677,0.31522407010533965,0.6560598787405117,LogisticRegression,"{'C': 0.1, 'class_weight': None, 'dual': False, 'fit_intercept': True, 'intercept_scaling': 1, 'l1_ratio': None, 'max_iter': 250, 'multi_class': 'deprecated', 'n_jobs': None, 'penalty': 'l2', 'random_state': None, 'solver': 'lbfgs', 'tol': 0.0001, 'verbose': 0, 'warm_start': False}",100 +Epistemic_Uncertainty,0.0008065631180243504,0.0007274353751131613,0.0009111247782999099,0.0006041748774102684,0.0019321481912188965,0.0006986473369927637,0.0020590402130271634,LogisticRegression,"{'C': 0.1, 'class_weight': None, 'dual': False, 'fit_intercept': True, 'intercept_scaling': 1, 'l1_ratio': None, 'max_iter': 250, 'multi_class': 'deprecated', 'n_jobs': None, 'penalty': 'l2', 'random_state': None, 'solver': 'lbfgs', 'tol': 0.0001, 'verbose': 0, 'warm_start': False}",100 +Jitter,0.00806887755102042,0.006519925537782693,0.010115706997084539,0.004305045898109686,0.029001480718470394,0.005883305802738843,0.033434755720469965,LogisticRegression,"{'C': 0.1, 'class_weight': None, 'dual': False, 'fit_intercept': True, 'intercept_scaling': 1, 'l1_ratio': None, 'max_iter': 250, 'multi_class': 'deprecated', 'n_jobs': None, 'penalty': 'l2', 'random_state': None, 'solver': 'lbfgs', 'tol': 0.0001, 'verbose': 0, 'warm_start': False}",100 +Label_Stability,0.9886250000000001,0.9911317567567568,0.9853124999999999,0.993908111174135,0.9592429022082021,0.9918851174934726,0.9507878787878787,LogisticRegression,"{'C': 0.1, 'class_weight': None, 'dual': False, 'fit_intercept': True, 'intercept_scaling': 1, 'l1_ratio': None, 'max_iter': 250, 'multi_class': 'deprecated', 'n_jobs': None, 'penalty': 'l2', 'random_state': None, 'solver': 'lbfgs', 'tol': 0.0001, 'verbose': 0, 'warm_start': False}",100 +TPR,0.9849785407725322,0.9897674418604652,0.9784537389100126,0.9950965369292063,0.9139784946236559,0.9916762342135477,0.889344262295082,LogisticRegression,"{'C': 0.1, 'class_weight': None, 'dual': False, 'fit_intercept': True, 'intercept_scaling': 1, 'l1_ratio': None, 'max_iter': 250, 'multi_class': 'deprecated', 'n_jobs': None, 'penalty': 'l2', 'random_state': None, 'solver': 'lbfgs', 'tol': 0.0001, 'verbose': 0, 'warm_start': False}",100 +TNR,0.24305555555555555,0.1743119266055046,0.3130841121495327,0.11026615969581749,0.44970414201183434,0.15895953757225434,0.5813953488372093,LogisticRegression,"{'C': 0.1, 'class_weight': None, 'dual': False, 'fit_intercept': True, 'intercept_scaling': 1, 'l1_ratio': None, 'max_iter': 250, 'multi_class': 'deprecated', 'n_jobs': None, 'penalty': 'l2', 'random_state': None, 'solver': 'lbfgs', 'tol': 0.0001, 'verbose': 0, 'warm_start': False}",100 +PPV,0.9182295573893473,0.9220103986135182,0.9130691898285038,0.9327779373743177,0.8204633204633205,0.9223171382808328,0.857707509881423,LogisticRegression,"{'C': 0.1, 'class_weight': None, 'dual': False, 'fit_intercept': True, 'intercept_scaling': 1, 'l1_ratio': None, 'max_iter': 250, 'multi_class': 'deprecated', 'n_jobs': None, 'penalty': 'l2', 'random_state': None, 'solver': 'lbfgs', 'tol': 0.0001, 'verbose': 0, 'warm_start': False}",100 +FNR,0.015021459227467811,0.010232558139534883,0.021546261089987327,0.004903463070793748,0.08602150537634409,0.008323765786452353,0.11065573770491803,LogisticRegression,"{'C': 0.1, 'class_weight': None, 'dual': False, 'fit_intercept': True, 'intercept_scaling': 1, 'l1_ratio': None, 'max_iter': 250, 'multi_class': 'deprecated', 'n_jobs': None, 'penalty': 'l2', 'random_state': None, 'solver': 'lbfgs', 'tol': 0.0001, 'verbose': 0, 'warm_start': False}",100 +FPR,0.7569444444444444,0.8256880733944955,0.6869158878504673,0.8897338403041825,0.5502958579881657,0.8410404624277457,0.4186046511627907,LogisticRegression,"{'C': 0.1, 'class_weight': None, 'dual': False, 'fit_intercept': True, 'intercept_scaling': 1, 'l1_ratio': None, 'max_iter': 250, 'multi_class': 'deprecated', 'n_jobs': None, 'penalty': 'l2', 'random_state': None, 'solver': 'lbfgs', 'tol': 0.0001, 'verbose': 0, 'warm_start': False}",100 +Accuracy,0.9079326923076924,0.9146959459459459,0.8989955357142857,0.9290981281905842,0.7902208201892744,0.9164490861618799,0.8090909090909091,LogisticRegression,"{'C': 0.1, 'class_weight': None, 'dual': False, 'fit_intercept': True, 'intercept_scaling': 1, 'l1_ratio': None, 'max_iter': 250, 'multi_class': 'deprecated', 'n_jobs': None, 'penalty': 'l2', 'random_state': None, 'solver': 'lbfgs', 'tol': 0.0001, 'verbose': 0, 'warm_start': False}",100 +F1,0.9504335447133428,0.9546882009869897,0.9446313857448762,0.9629300118623962,0.8646998982706002,0.9557399723374828,0.8732394366197183,LogisticRegression,"{'C': 0.1, 'class_weight': None, 'dual': False, 'fit_intercept': True, 'intercept_scaling': 1, 'l1_ratio': None, 'max_iter': 250, 'multi_class': 'deprecated', 'n_jobs': None, 'penalty': 'l2', 'random_state': None, 'solver': 'lbfgs', 'tol': 0.0001, 'verbose': 0, 'warm_start': False}",100 +Selection-Rate,0.9612980769230769,0.9746621621621622,0.9436383928571429,0.9872376630743052,0.8170347003154574,0.9780678851174934,0.7666666666666667,LogisticRegression,"{'C': 0.1, 'class_weight': None, 'dual': False, 'fit_intercept': True, 'intercept_scaling': 1, 'l1_ratio': None, 'max_iter': 250, 'multi_class': 'deprecated', 'n_jobs': None, 'penalty': 'l2', 'random_state': None, 'solver': 'lbfgs', 'tol': 0.0001, 'verbose': 0, 'warm_start': False}",100 +Sample_Size,4160.0,2368.0,1792.0,3526.0,634.0,3830.0,330.0,LogisticRegression,"{'C': 0.1, 'class_weight': None, 'dual': False, 'fit_intercept': True, 'intercept_scaling': 1, 'l1_ratio': None, 'max_iter': 250, 'multi_class': 'deprecated', 'n_jobs': None, 'penalty': 'l2', 'random_state': None, 'solver': 'lbfgs', 'tol': 0.0001, 'verbose': 0, 'warm_start': False}",100 diff --git a/tests/user_interfaces/conftest.py b/tests/user_interfaces/conftest.py index fe2028b6..5359375c 100644 --- a/tests/user_interfaces/conftest.py +++ b/tests/user_interfaces/conftest.py @@ -32,7 +32,7 @@ def law_school_dataset_1k_params(common_seed): # Preprocess the dataset column_transformer = ColumnTransformer(transformers=[ - ('categorical_features', OneHotEncoder(handle_unknown='ignore', sparse=False), data_loader.categorical_columns), + ('categorical_features', OneHotEncoder(handle_unknown='ignore', sparse_output=False), data_loader.categorical_columns), ('numerical_features', StandardScaler(), data_loader.numerical_columns), ]) base_flow_dataset = preprocess_dataset(data_loader=data_loader, @@ -64,7 +64,7 @@ def law_school_dataset_20k_params(common_seed): # Preprocess the dataset column_transformer = ColumnTransformer(transformers=[ - ('categorical_features', OneHotEncoder(handle_unknown='ignore', sparse=False), data_loader.categorical_columns), + ('categorical_features', OneHotEncoder(handle_unknown='ignore', sparse_output=False), data_loader.categorical_columns), ('numerical_features', StandardScaler(), data_loader.numerical_columns), ]) base_flow_dataset = preprocess_dataset(data_loader=data_loader, diff --git a/tests/user_interfaces/test_compute_model_metrics.py b/tests/user_interfaces/test_compute_model_metrics.py index f2494c70..24374f7c 100644 --- a/tests/user_interfaces/test_compute_model_metrics.py +++ b/tests/user_interfaces/test_compute_model_metrics.py @@ -23,7 +23,7 @@ def test_subgroup_variance_and_error_analyzers(COMPAS_y_test, COMPAS_RF_bootstra data_loader = CompasWithoutSensitiveAttrsDataset() sensitive_attributes_dct = {'sex': 1, 'race': 'African-American', 'sex&race': None} column_transformer = ColumnTransformer(transformers=[ - ('categorical_features', OneHotEncoder(handle_unknown='ignore', sparse=False), data_loader.categorical_columns), + ('categorical_features', OneHotEncoder(handle_unknown='ignore', sparse_output=False), data_loader.categorical_columns), ('numerical_features', StandardScaler(), data_loader.numerical_columns), ]) base_flow_dataset = preprocess_dataset(data_loader=data_loader, diff --git a/tests/user_interfaces/test_multiple_models_api.py b/tests/user_interfaces/test_multiple_models_api.py index c5fda9f5..14d1bb3e 100644 --- a/tests/user_interfaces/test_multiple_models_api.py +++ b/tests/user_interfaces/test_multiple_models_api.py @@ -1,3 +1,4 @@ +import sys import copy import pathlib @@ -76,15 +77,18 @@ def test_compute_metrics_with_config_should_equal_prev_release_results(law_schoo models_config=copy.deepcopy(models_config), save_results_dir_path=save_results_dir_path) - metrics_path = str(pathlib.Path(__file__).parent.parent.joinpath('files_for_tests', 'law_school_dataset_20k')) + if sys.version_info.major == 3 and sys.version_info.minor >= 12: + print("Python 3.12 or newer is installed.") + metrics_path = str(pathlib.Path(__file__).parent.parent.joinpath('files_for_tests', 'law_school_dataset_20k', 'python_3_12+')) + else: + print("Older version of Python is installed.") + metrics_path = str(pathlib.Path(__file__).parent.parent.joinpath('files_for_tests', 'law_school_dataset_20k', 'python_3_11-')) + expected_metrics_dct = read_model_metric_dfs(metrics_path, model_names=['LogisticRegression', 'DecisionTreeClassifier']) # Drop technical columns metrics_dct['LogisticRegression'] = metrics_dct['LogisticRegression'].drop('Runtime_in_Mins', axis=1) metrics_dct['DecisionTreeClassifier'] = metrics_dct['DecisionTreeClassifier'].drop('Runtime_in_Mins', axis=1) - expected_metrics_dct['LogisticRegression'] = expected_metrics_dct['LogisticRegression'].drop('Runtime_in_Mins', axis=1) - expected_metrics_dct['DecisionTreeClassifier'] = expected_metrics_dct['DecisionTreeClassifier'].drop('Runtime_in_Mins', axis=1) - assert compare_metric_dfs_with_tolerance(expected_metrics_dct['LogisticRegression'], metrics_dct['LogisticRegression']) assert compare_metric_dfs_with_tolerance(expected_metrics_dct['DecisionTreeClassifier'], metrics_dct['DecisionTreeClassifier']) diff --git a/tests/utils/test_stability_utils.py b/tests/utils/test_stability_utils.py index 44cc362c..8e6c0cf9 100644 --- a/tests/utils/test_stability_utils.py +++ b/tests/utils/test_stability_utils.py @@ -65,7 +65,7 @@ def test_count_prediction_metrics_true2(COMPAS_y_test, COMPAS_RF_bootstrap_predi # ========================== Test generate_bootstrap ========================== def test_generate_bootstrap_true1(compas_without_sensitive_attrs_dataset_class, config_params): column_transformer = ColumnTransformer(transformers=[ - ('categorical_features', OneHotEncoder(handle_unknown='ignore', sparse=False), compas_without_sensitive_attrs_dataset_class.categorical_columns), + ('categorical_features', OneHotEncoder(handle_unknown='ignore', sparse_output=False), compas_without_sensitive_attrs_dataset_class.categorical_columns), ('numerical_features', StandardScaler(), compas_without_sensitive_attrs_dataset_class.numerical_columns), ]) base_flow_ds = preprocess_dataset(compas_without_sensitive_attrs_dataset_class, diff --git a/virny/utils/stability_utils.py b/virny/utils/stability_utils.py index c0612d4c..7f572e83 100644 --- a/virny/utils/stability_utils.py +++ b/virny/utils/stability_utils.py @@ -1,3 +1,4 @@ +import sys import numpy as np import pandas as pd @@ -84,8 +85,13 @@ def count_prediction_metrics(y_true, uq_results, with_predict_proba: bool = True def generate_bootstrap(features, labels, boostrap_size, with_replacement=True, random_state=None): - # Create a local random state - rng = np.random.RandomState(random_state) + # Create a local random state. + # Note that to keep reverse compatibility we need to use different generators for different python versions + # since random number generation was changed in Python 3.12 + if sys.version_info.major == 3 and sys.version_info.minor >= 12: + rng = np.random.default_rng(seed=random_state) + else: + rng = np.random.RandomState(random_state) # Generate bootstrapped indexes bootstrap_index = rng.choice(features.shape[0], size=boostrap_size, replace=with_replacement)