odtlearn.flow_opt
#
Module Contents#
Classes#
An optimal decision tree that prescribes treatments (as opposed to predicting class labels), |
|
Helper class that provides a standard way to create an ABC using |
|
Helper class that provides a standard way to create an ABC using |
- class odtlearn.flow_opt.FlowOPT_IPW(solver, depth=1, time_limit=60, num_threads=None, verbose=False)[source]#
Bases:
odtlearn.flow_opt_ss.FlowOPTSingleSink
An optimal decision tree that prescribes treatments (as opposed to predicting class labels), fitted on a binary-valued observational data set.
- Parameters:
- solver: str
A string specifying the name of the solver to use to solve the MIP. Options are “Gurobi” and “CBC”. If the CBC binaries are not found, Gurobi will be used by default.
- depthint, default=1
A parameter specifying the depth of the tree to learn.
- time_limitint
The given time limit for solving the MIP in seconds.
- methodstr, default=’IPW’
The method of Prescriptive Trees to run. Choices in (‘IPW’, ‘DM’, ‘DR), which represents the inverse propensity weighting, direct method, and doubly robust methods, respectively.
- num_threads: int, default=None
The number of threads the solver should use. If not specified, solver uses all available threads.
- verbosebool, default = False
Flag for logging solver outputs.
- fit(X, t, y, ipw)[source]#
Method to fit the PrescriptiveTree class on the data
- Parameters:
- Xarray-like, shape (n_samples, n_features)
The training input samples.
- tarray-like, shape (n_samples,)
The treatment values. An array of int.
- yarray-like, shape (n_samples,)
The observed outcomes upon given treatment t. An array of int.
- ipwarray-like, shape (n_samples,)
The inverse propensity weight estimates. An array of floats in [0, 1].
- Returns:
- selfobject
Returns self.
- class odtlearn.flow_opt.FlowOPT_DM(solver, depth=1, time_limit=60, num_threads=None, verbose=False)[source]#
Bases:
odtlearn.flow_opt_ms.FlowOPTMultipleSink
Helper class that provides a standard way to create an ABC using inheritance.
- fit(X, t, y, y_hat)[source]#
Method to fit the PrescriptiveTree class on the data
- Parameters:
- Xarray-like, shape (n_samples, n_features)
The training input samples.
- tarray-like, shape (n_samples,)
The treatment values. An array of int.
- yarray-like, shape (n_samples,)
The observed outcomes upon given treatment t. An array of int.
- y_hat: array-like, shape (n_samples, n_treatments)
The counterfactual predictions.
- Returns:
- selfobject
Returns self.
- class odtlearn.flow_opt.FlowOPT_DR(solver, depth=1, time_limit=60, num_threads=None, verbose=False)[source]#
Bases:
odtlearn.flow_opt_ms.FlowOPTMultipleSink
Helper class that provides a standard way to create an ABC using inheritance.
- fit(X, t, y, ipw, y_hat)[source]#
Method to fit the PrescriptiveTree class on the data
- Parameters:
- Xarray-like, shape (n_samples, n_features)
The training input samples.
- tarray-like, shape (n_samples,)
The treatment values. An array of int.
- yarray-like, shape (n_samples,)
The observed outcomes upon given treatment t. An array of int.
- ipwarray-like, shape (n_samples,)
The inverse propensity weight estimates. An array of floats in [0, 1].
- y_hat: array-like, shape (n_samples, n_treatments)
The counterfactual predictions.
- Returns:
- selfobject
Returns self.