econml.inference._bootstrap
Bootstrap sampling.
Classes
|
Estimator that uses bootstrap sampling to wrap an existing estimator. |
- class econml.inference._bootstrap.BootstrapEstimator(wrapped, n_bootstrap_samples=100, n_jobs=None, verbose=0, compute_means=True, bootstrap_type='pivot')[source]
Bases:
object
Estimator that uses bootstrap sampling to wrap an existing estimator.
This estimator provides a fit method with the same signature as the wrapped estimator.
The bootstrap estimator will also wrap all other methods and attributes of the wrapped estimator, but return the average of the sampled calculations (this will fail for non-numeric outputs).
It will also provide a wrapper method suffixed with _interval for each method or attribute of the wrapped estimator that takes two additional optional keyword arguments lower and upper specifiying the percentiles of the interval, and which uses np.percentile to return the corresponding lower and upper bounds based on the sampled calculations. For example, if the underlying estimator supports an effect method with signature (X,T) -> Y, this class will provide a method effect_interval with pseudo-signature (lower=5, upper=95, X, T) -> (Y, Y) (where lower and upper cannot be supplied as positional arguments).
- Parameters
wrapped (object) – The basis for the clones used for estimation. This object must support a fit method which takes numpy arrays with consistent first dimensions as arguments.
n_bootstrap_samples (int, default: 100) – How many draws to perform.
n_jobs (int, default: None) – The maximum number of concurrently running jobs, as in joblib.Parallel.
verbose (int, default: 0) – Verbosity level
compute_means (bool, default: True) – Whether to pass calls through to the underlying collection and return the mean. Setting this to
False
can avoid ambiguities if the wrapped object itself has method names with an _interval suffix.bootstrap_type (‘percentile’, ‘pivot’, or ‘normal’, default ‘pivot’) – Bootstrap method used to compute results. ‘percentile’ will result in using the empiracal CDF of the replicated computations of the statistics. ‘pivot’ will also use the replicates but create a pivot interval that also relies on the estimate over the entire dataset. ‘normal’ will instead compute an interval assuming the replicates are normally distributed.