Comments (2)
Analyzing better how _safe_norm_ppf was built, I think the only needed fix that we could do was to remove the outside loop and only pass:
_safe_norm_ppf(1 - alpha / 2, loc=self.point_estimate, scale=self.stderr), _safe_norm_ppf(alpha / 2, loc=self.point_estimate, scale=self.stderr)
A simple simulation between the two methods:
import scipy
import timeit
import numpy as np
from time import perf_counter
from contextlib import contextmanager
size = 10000
@contextmanager
def catchtime() -> float:
start = perf_counter()
yield lambda: perf_counter() - start
print(f'Time: {perf_counter() - start:.3f} seconds')
loc_array = np.random.normal(loc=0, scale=0.1, size=size)
scale_array = np.abs(np.random.normal(loc=0, scale=0.001, size=size))
print('Method without loop')
with catchtime() as t:
a = scipy.stats.norm.ppf(q=0.05, loc=loc_array, scale=scale_array), scipy.stats.norm.ppf(q=0.95, loc=loc_array, scale=scale_array)
print(a)
print('Method with loop')
with catchtime() as t:
b = np.array([scipy.stats.norm.ppf(q=0.05, loc=loc, scale=scale) for loc, scale in zip(loc_array, scale_array)]), np.array([scipy.stats.norm.ppf(q=0.95, loc=loc, scale=scale) for loc, scale in zip(loc_array, scale_array)])
print(b)
That prints:
Method without loop
Time: 0.003 seconds
(array([ 0.05063444, -0.00281694, 0.09580098, ..., -0.0103138 ,
0.05915183, 0.09202236]), array([ 0.05225244, -0.00042525, 0.09687321, ..., -0.00561028,
0.06531339, 0.0939663 ]))
Method with loop
Time: 2.423 seconds
(array([ 0.05063444, -0.00281694, 0.09580098, ..., -0.0103138 ,
0.05915183, 0.09202236]), array([ 0.05225244, -0.00042525, 0.09687321, ..., -0.00561028,
0.06531339, 0.0939663 ]))
[ 0.05063444 -0.00281694 0.09580098 ... -0.0103138 0.05915183
0.09202236]
from econml.
Issue solved by #879
from econml.
Related Issues (20)
- Is a feature engineered from treatment T another treatment to consider for CATE?
- Will DRIV be able to support multiple treatments via multiple instruments?
- DynamicDML() issue: AttributeError: Provided crossfit folds contain training splits that don't contain all treatments DynamicDML HOT 5
- Inconsistent ATE estimation HOT 3
- Confidence Interval for categorical outcome HOT 3
- [Bug] fit_cate_incercept argument in econml.dml.DML does not add intercept correctly HOT 5
- `shap_values` for tree-based models doesn't set `check_additivity=False` as expected HOT 3
- A column-vector y was passed when a 1d array was expected (however, y is already a 1d array) HOT 1
- Individual Treatment Effects HOT 1
- How to get the Confidence Interval for ATE instead of CATE HOT 1
- Converting to Python object not allowed without gil HOT 1
- Reproducible error: SHAP ExplainerError: Additivity check failed in TreeExplainer HOT 4
- Questions regarding DRPolicyForest results HOT 2
- DRtester does not work for binary treatment AND binary outcome HOT 4
- Confounder adjusting before applying the ITE model to observational data
- DML discrete outcome HOT 1
- High memory footprint for big dataframes in CausalForest model HOT 3
- Questions about econml and CausalForestDML
- Reduce residual confounding in time series
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from econml.