dualbounds.dist_reg.BinaryDistReg

class dualbounds.dist_reg.BinaryDistReg(model_type: str | BaseEstimator = 'logistic', monotonicity: bool = False, monotonicity_margin: float = 0.005, how_transform: str = 'interactions', **model_kwargs)[source]

Binary regression which inherits from DistReg

Parameters:
model_type : str or sklearn class.

Str specifying a sklearn model class to use; options include ‘ridge’, ‘lasso’, ‘elasticnet’, ‘randomforest’, ‘knn’. One can also directly pass an sklearn class, e.g., model_type=sklearn.linear_model.LogisticRegressionCV.

how_transform : str

Str specifying how to transform the features before fitting the underlying model. One of several options:

  • ’identity’: does not transform the features

  • ’intercept’: adds an intercept

  • ’interactions’ : adds treatment-covariate interactions

The default is interactions.

montonicity : bool

If True, ensures \(P(Y_i(1) = 1 | X_i) - P(Y_i(0) = 1 | X_i)\) >= 0.

monotonicity_margin : float

When self.monotonicity = True, ensures that \(P(Y_i(1) = 1 | X_i) - P(Y_i(0) = 1 | X_i)\) >= margin. This is important for numerical stability but does not affect validity.

model_kwargs : dict

kwargs to sklearn model class.

Methods

feature_transform(W, X[, Z])

Transforms the features before feeding them to the base model.

features_to_WX(features)

Inverse of feature_transform.

fit(W, X, y[, Z, sample_weight])

Fits model on the data.

predict(X, W[, Z])

Predicts the conditional law of the outcome.

predict_counterfactuals(X)

Predicts counterfactual distributions of Y (outcome).

predict_proba(X, W[, Z])