fair_seldonian.models package

Submodules

fair_seldonian.models.logistic_regression module

fair_seldonian.models.logistic_regression.predict(theta, theta1, X)[source]

This is the predict function for Logistic Regression. Currently, it implements: 1 / (1 + e^-(X.theta + theta1))

Parameters:
  • theta (Tensor | None) – The optimal theta values for the model

  • theta1 (Tensor | None) – The additional optimal theta values for the model

  • X (ndarray) – The features of the dataset

Returns:

The probability value of label 1 of the complete dataset

Return type:

Tensor

fair_seldonian.models.logistic_regression.f_hat(theta, theta1, X, Y)[source]

Main objective function: negative log loss.

Parameters:
  • theta (torch.Tensor | None) – The optimal theta values for the model

  • theta1 (torch.Tensor | None) – The additional optimal theta values for the model

  • X (np.ndarray) – The features of the dataset

  • Y (Array) – The true labels of the dataset

Returns:

The negative log loss

Return type:

torch.Tensor

fair_seldonian.models.logistic_regression.simple_logistic(X, Y)[source]

Runs simple logistic regression.

Parameters:
  • X (np.ndarray) – The features of the dataset

  • Y (Array) – The true labels of the dataset

Returns:

The theta values (parameters) of the model

Return type:

tuple[torch.Tensor, torch.Tensor]

fair_seldonian.models.logistic_regression.eval_ghat(theta, theta1, X, Y, T, seldonian_type, config=SeldonianConfig(delta=0.05, inequality=<Inequality.HOEFFDING_INEQUALITY: 2>, constraint='TP(1) TP(0) - abs 0.25 TP(1) * -', candidate_ratio=0.4))[source]
Parameters:
Return type:

Bound

fair_seldonian.models.logistic_regression.ghat(theta, theta1, X, Y, T, candidate_ratio, seldonian_type, config=SeldonianConfig(delta=0.05, inequality=<Inequality.HOEFFDING_INEQUALITY: 2>, constraint='TP(1) TP(0) - abs 0.25 TP(1) * -', candidate_ratio=0.4))[source]
Parameters:
Return type:

Bound

fair_seldonian.models.logistic_regression.ghat_base(theta, theta1, X, Y, T, predict_bound, candidate_ratio, modified_h, config=SeldonianConfig(delta=0.05, inequality=<Inequality.HOEFFDING_INEQUALITY: 2>, constraint='TP(1) TP(0) - abs 0.25 TP(1) * -', candidate_ratio=0.4))[source]
Parameters:
Return type:

Bound

fair_seldonian.models.logistic_regression.eval_ghat_base(theta, theta1, X, Y, T, modified_h, config=SeldonianConfig(delta=0.05, inequality=<Inequality.HOEFFDING_INEQUALITY: 2>, constraint='TP(1) TP(0) - abs 0.25 TP(1) * -', candidate_ratio=0.4))[source]
Parameters:
Return type:

Bound

fair_seldonian.models.logistic_regression.ghat_extend(theta, theta1, X, Y, T, predict_bound, candidate_ratio, check_bound, check_const, modified_h, config=SeldonianConfig(delta=0.05, inequality=<Inequality.HOEFFDING_INEQUALITY: 2>, constraint='TP(1) TP(0) - abs 0.25 TP(1) * -', candidate_ratio=0.4))[source]
Parameters:
Return type:

Bound

fair_seldonian.models.logistic_regression.eval_ghat_extend(theta, theta1, X, Y, T, check_bound, check_const, modified_h, config=SeldonianConfig(delta=0.05, inequality=<Inequality.HOEFFDING_INEQUALITY: 2>, constraint='TP(1) TP(0) - abs 0.25 TP(1) * -', candidate_ratio=0.4))[source]
Parameters:
Return type:

Bound

Module contents