Closed rfl-urbaniak closed 9 months ago
I now see merge conflicts, @riadas did you make any changes in the target? If any controversial conflict I'll deal with it tomorrow, jus take a look if you have the time and let me know.
Works on the frontend without out-of-memory errors! Thanks for getting on this so quickly.
Works on the frontend without out-of-memory errors! Thanks for getting on this so quickly.
using ChiRho, Pyro, and
pyro.infer.Predictive
in the front to evaluate counterfactual claims end was too demanding for front-end use. This PR provides a slim version that can be used in the front-end without even having Pyro or ChiRho among the dependencies. This is possible as for now we are interested in queries of one format, answers to which can be calculated pretty much by hand once we have cached model samples. The caching can be done once after fresh model training and needs not to be repeated unless model guides and params are modified.pip install -e .
pip install -e .[dev]
orpip install -e ".dev"
(if the former doesn't work) This was needed so that the slim version can be decoupled from heavy dependencies. It should be sufficient for front end use.Note: pytests won't work as some tests involve heavier dependencies. but you can install an intermediate version:
pip install -e ".[test]"
which should make
make test_notebooks
work properly (but notmake test
). The former is a backend dev proxy for whether all basic functionalities needed for the front end are in good shape.For the above reason, notebook tests have been decoupled from the standard pytest test. They now check the running of all notebooks in
docs/guides
and are triggered bymake test_notebooks
. In contrast,make test
triggers first thepytest
test and the notebook dry runs. This was needed as all notebooks were repeatedly run to test the slim version in development.The
data
folder now contains a foldertau_samples
. This was generated usingcities.modeling.tau_caching_pipeline
. All front end functionalities should be available if this folder is present, even withoutdata/model_guides
, which is a much heavier folder - try deleting the latter on the server, let me know if anything fails.CausalInsight
has been expanded.generate_tensed_samples
serializes tau samples in the corresponding data folder if such samples for a particular intervention-outcome pair are missing. It also contains a new method,get_tau_samples
, which is a slim counterpart ofgenerate_tensed_samples
and should be used instead in front end applications.In dev mode, inspect 'docs/experimental_notebooks/slimming/slim_insight.ipynb` which illustrates performance differences between the two methods.
In slim mode visit
docs/experimental_notebooks/slimming?slim_use.ipynb
, which shows the pieces of code that should replace what's currently used in the front end. The change is rather minimal. Make sure it works in the slim mode.In the [test] mode (but not dev) run
make test notebooks
to ensure all front end functionalities are still running.Also,
make format
andmake lint
also cleans up the notebooks indocs/guides
.