packtpublishing / causal-inference-and-discovery-in-python Goto Github PK
View Code? Open in Web Editor NEWCausal Inference and Discovery in Python by Packt Publishing
License: MIT License
Causal Inference and Discovery in Python by Packt Publishing
License: MIT License
Hi Alex,
Please find below an environment file that successfully runs GPU related codes in Chapters 11.1 and 14 (as .txt as it won't accept yml - should just be able to change the extension back)
causal_book_py39_for_m1.txt. The changes from the yml provided in your repo are:
- nvidia
from channels; remove - pytorch
and -pytorch-cuda=11.7
from dependencies- notebook=6.5
to dependenciesThen replace the set device cell with
# Set device
device = "mps" if torch.backends.mps.is_available() else "cpu"
I still then had to pip install CausalPy once the env was activated.
The full yml as exported by conda is
causal_book_py39_applem1.txt
Notes:
assert len(dataset_train.batch_size) == 1, "Only 1D batch size is supported"
), an errors occurs with message "NotImplementedError: The operator 'aten::triu_indices' is not currently implemented for the MPS device. If you want this op to be added in priority during the prototype phase of this feature, please comment on https://github.com/pytorch/pytorch/issues/77764. As a temporary fix, you can set the environment variable
PYTORCH_ENABLE_MPS_FALLBACK=1 to use the CPU as a fallback for this op. WARNING: this will be slower than running natively on MPS.
"Both chapter 9 and chapter 10 notebooks have code like effect_pred = model.causal_estimator.effect()
.
I got an error running them: AttributeError: 'CausalModel' object has no attribute 'causal_estimator'
The book states that it uses DoWhy 0.8 but I am currently using DoWhy 0.10.1 (just want to keep my learning experience up-to-date) but I cannot determine if that's the cause of it. If it is, then how to implement the model on test dataset with current version of DoWhy? If not, then what have I missed?
Thanks!
Loving that these resources are on GitHub - thank you @AlxndrMlk!
Quick notational suggestion: on p27, the line
The right-side reads as a boolean, and the condition can never be satisfied, as written.
Would be clearer what's meant if it was "...sampled according to the condition
Hello, I am Jake Lee from Korea, a passionate reader of your book
I have found that couple of codes not working for prediction part in Ch09.
Your code flow as following
However #4 is not working from my side (description said there is no object of causal_estimator)
It would be appreciate if you give me help on it, especially in case that code is running in latest DoWhy version (11.0)
Thanks in advance!
Jake
It would be a real help for anyone wanting to cite the book if you could add the bibtex entry text to the bottom of the README.md
๐
Along the same lines... I'm not sure if it's under your control, but I also can't find the bibtex citation through a Google Scholar search.
Possibly related to the numba deprecation warning , the following code spits out an array shape error, which then propogates errors in the remaining cells in the chapter 7 notebook. I tried upgrading shap to 0.42.0 which resolved some but not all of the errors.
`estimate = model.estimate_effect(
identified_estimand=estimand,
method_name='backdoor.econml.dml.DML',
method_params={
'init_params': {
'model_y': GradientBoostingRegressor(),
'model_t': GradientBoostingRegressor(),
'model_final': LassoCV(fit_intercept=False),
},
'fit_params': {}}
)
print(f'Estimate of causal effect (DML): {estimate.value}')
`
A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples, ), for example using ravel().
The command conda env create -f causal_book_py39_cuda117.yml
never finishes. Tested on Windows and WSL. Anyone else encountering this issue? Found a solution?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.