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))
- 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:
- 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:
- 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:
theta (torch.Tensor)
theta1 (torch.Tensor)
X (np.ndarray)
Y (Array)
T (Array)
seldonian_type (str)
config (SeldonianConfig)
- 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:
theta (torch.Tensor)
theta1 (torch.Tensor)
X (np.ndarray)
Y (Array)
T (Array)
candidate_ratio (float)
seldonian_type (str)
config (SeldonianConfig)
- 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:
theta (torch.Tensor)
theta1 (torch.Tensor)
X (np.ndarray)
Y (Array)
T (Array)
predict_bound (bool)
candidate_ratio (float | None)
modified_h (bool)
config (SeldonianConfig)
- 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:
theta (torch.Tensor)
theta1 (torch.Tensor)
X (np.ndarray)
Y (Array)
T (Array)
modified_h (bool)
config (SeldonianConfig)
- 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:
theta (torch.Tensor)
theta1 (torch.Tensor)
X (np.ndarray)
Y (Array)
T (Array)
predict_bound (bool)
candidate_ratio (float | None)
check_bound (bool)
check_const (bool)
modified_h (bool)
config (SeldonianConfig)
- 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:
theta (torch.Tensor)
theta1 (torch.Tensor)
X (np.ndarray)
Y (Array)
T (Array)
check_bound (bool)
check_const (bool)
modified_h (bool)
config (SeldonianConfig)
- Return type:
Bound