Skip to content

Conversation

@NglQ
Copy link

@NglQ NglQ commented Sep 9, 2024

Robust probability computation of weights

Traceback (most recent call last):
  File "postprocessing.py", line 240, in <module>
    pipeline(load_fn=dataset_name_to_load_fn[dataset_name],
  File "postprocessing.py", line 208, in pipeline
    unprocessed_clf.fit(X=data_splits['X_' + fit_data], y=data_splits['y_' + fit_data], group=data_splits['s_' + fit_data])
  File "error_parity/threshold_optimizer.py", line 485, in fit
    g: RandomizedClassifier.construct_at_target_ROC(
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "error_parity/classifiers.py", line 372, in construct_at_target_ROC
    weights, points = RandomizedClassifier.find_weights_given_two_points(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "error_parity/classifiers.py", line 283, in find_weights_given_two_points
    raise RuntimeError(
RuntimeError: Triangulation of target point failed. Target was [5.65363161e-07 5.42325664e-07]; got [5.42325665e-07 5.42325665e-07].

The issue has been found using "ACSDataSource(survey_year='2018', horizon='1-Year', survey='person')" as dataset, with the basic problem "ACSEmployment". The split is 70-10-20 using the function train_test_split of sklearn with shuffle=True, stratify on sensitive attribute (RAC1P) and seed 42. Moreover, the RelaxedThreshold had equalized odds as constraint and threshold 1.0 (The experiment involves FairGBM as model).

Robust probability computation of weights
@NglQ NglQ changed the title Update classifiers.py Robust computation of the probability weights Sep 9, 2024
@AndreFCruz
Copy link
Member

Thanks for reporting this bug!
I'll double-check everything is fine and accept the atol modification in the next few days 🙂

f"Target was {target_point}; got {all_weights @ all_points}."
)

if (all_weights < 0).any():
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you ever encounter a scenario where any weights were negative? And if so, could you post a code example?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants