causal-testing-framework 14.3.0__tar.gz → 15.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- causal_testing_framework-15.0.0/.github/PULL_REQUEST_TEMPLATE.md +8 -0
- causal_testing_framework-15.0.0/.github/workflows/build-docs.yaml +29 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/.github/workflows/ci-tests-drafts.yaml +1 -1
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/.github/workflows/ci-tests.yaml +1 -1
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/.pre-commit-config.yaml +8 -8
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/PKG-INFO +7 -8
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/README.md +2 -2
- causal_testing_framework-15.0.0/causal_testing/__main__.py +283 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/causal_testing/_version.py +3 -3
- causal_testing_framework-15.0.0/causal_testing/causal_testing_framework.py +281 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/causal_testing/discovery/abstract_discovery.py +59 -70
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/causal_testing/discovery/hill_climber_discovery.py +16 -19
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/causal_testing/discovery/nsga_discovery.py +2 -2
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/causal_testing/estimation/abstract_estimator.py +30 -29
- causal_testing_framework-15.0.0/causal_testing/estimation/abstract_regression_estimator.py +205 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/causal_testing/estimation/experimental_estimator.py +18 -53
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/causal_testing/estimation/instrumental_variable_estimator.py +28 -29
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/causal_testing/estimation/ipcw_estimator.py +49 -73
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/causal_testing/estimation/linear_regression_estimator.py +30 -59
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/causal_testing/estimation/logistic_regression_estimator.py +3 -2
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/causal_testing/estimation/multinomial_regression_estimator.py +3 -2
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/causal_testing/specification/causal_dag.py +246 -36
- causal_testing_framework-15.0.0/causal_testing/testing/causal_effect.py +166 -0
- causal_testing_framework-15.0.0/causal_testing/testing/causal_test_case.py +196 -0
- causal_testing_framework-15.0.0/causal_testing/testing/causal_test_result.py +52 -0
- causal_testing_framework-15.0.0/causal_testing/testing/dag_adequacy.py +59 -0
- causal_testing_framework-15.0.0/causal_testing/testing/data_adequacy.py +50 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/causal_testing_framework.egg-info/PKG-INFO +7 -8
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/causal_testing_framework.egg-info/SOURCES.txt +23 -27
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/causal_testing_framework.egg-info/requires.txt +1 -4
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/causal_testing_framework.egg-info/scm_file_list.json +153 -157
- causal_testing_framework-15.0.0/causal_testing_framework.egg-info/scm_version.json +8 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/causal_testing_framework.egg-info/top_level.txt +0 -1
- causal_testing_framework-15.0.0/docs/source/_static/images/.gitignore +3 -0
- causal_testing_framework-15.0.0/docs/source/_static/images/discovery-workflow.png +0 -0
- causal_testing_framework-15.0.0/docs/source/_static/images/discovery-workflow.tex +114 -0
- causal_testing_framework-15.0.0/docs/source/_static/images/testing-workflow-dark.png +0 -0
- causal_testing_framework-15.0.0/docs/source/_static/images/testing-workflow.png +0 -0
- causal_testing_framework-15.0.0/docs/source/_static/images/testing-workflow.tex +127 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/docs/source/conf.py +3 -1
- causal_testing_framework-15.0.0/docs/source/dafni.rst +43 -0
- causal_testing_framework-15.0.0/docs/source/glossary.rst +86 -0
- causal_testing_framework-15.0.0/docs/source/index.rst +202 -0
- causal_testing_framework-15.0.0/docs/source/installation.rst +101 -0
- causal_testing_framework-15.0.0/docs/source/modules/causal_dag.rst +43 -0
- causal_testing_framework-14.3.0/docs/source/modules/discovery.rst → causal_testing_framework-15.0.0/docs/source/modules/causal_discovery.rst +24 -25
- causal_testing_framework-15.0.0/docs/source/modules/causal_estimate.rst +160 -0
- causal_testing_framework-15.0.0/docs/source/modules/causal_tests.rst +33 -0
- causal_testing_framework-15.0.0/docs/source/modules/test_adequacy.rst +40 -0
- causal_testing_framework-15.0.0/docs/source/modules/test_data.rst +30 -0
- causal_testing_framework-15.0.0/docs/source/modules/test_oracle.rst +80 -0
- causal_testing_framework-15.0.0/docs/source/quick_start/causal_discovery.rst +46 -0
- causal_testing_framework-15.0.0/docs/source/quick_start/causal_testing.rst +72 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/docs/source/tutorials/poisson_line_process/poisson_line_process_tutorial.ipynb +38 -108
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/docs/source/tutorials/vaccinating_elderly/causal_tests.json +36 -45
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/docs/source/tutorials/vaccinating_elderly/vaccinating_elderly_tutorial.ipynb +30 -38
- causal_testing_framework-15.0.0/docs/source/tutorials/visualising_causal_test_results/visualise_causal_test_results.ipynb +264 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/examples/covasim_/doubling_beta/example_beta.py +24 -33
- causal_testing_framework-15.0.0/examples/covasim_/vaccinating_elderly/example_vaccine.py +80 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/examples/lr91/example_max_conductances.py +23 -61
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/examples/poisson-line-process/example_pure_python.py +39 -75
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/paper/paper.md +1 -1
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/pyproject.toml +1 -3
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/tests/discovery_tests/test_abstract_discovery.py +163 -58
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/tests/discovery_tests/test_hill_climber_discovery.py +18 -15
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/tests/discovery_tests/test_nsga_discovery.py +8 -5
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/tests/estimation_tests/test_experimental_estimator.py +7 -10
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/tests/estimation_tests/test_genetic_programming_regression_fitter.py +29 -1
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/tests/estimation_tests/test_instrumental_variable_estimator.py +27 -7
- causal_testing_framework-15.0.0/tests/estimation_tests/test_ipcw_estimator.py +104 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/tests/estimation_tests/test_linear_regression_estimator.py +213 -117
- causal_testing_framework-15.0.0/tests/estimation_tests/test_logistic_regression_estimator.py +26 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/tests/estimation_tests/test_multinomial_regression_estimator.py +20 -13
- causal_testing_framework-15.0.0/tests/main_tests/test_ctf.py +210 -0
- causal_testing_framework-15.0.0/tests/main_tests/test_main.py +276 -0
- causal_testing_framework-15.0.0/tests/resources/data/data.csv +6 -0
- causal_testing_framework-15.0.0/tests/resources/data/data.pqt +0 -0
- causal_testing_framework-15.0.0/tests/resources/data/tests.json +23 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/tests/specification_tests/test_causal_dag.py +67 -30
- causal_testing_framework-15.0.0/tests/specification_tests/test_generate_causal_tests.py +167 -0
- causal_testing_framework-15.0.0/tests/testing_tests/test_causal_effect.py +185 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/tests/testing_tests/test_causal_test_adequacy.py +155 -80
- causal_testing_framework-15.0.0/tests/testing_tests/test_causal_test_case.py +218 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/tests/tutorial_tests/test_tutorials.py +3 -2
- causal_testing_framework-14.3.0/causal_testing/__main__.py +0 -137
- causal_testing_framework-14.3.0/causal_testing/estimation/abstract_regression_estimator.py +0 -157
- causal_testing_framework-14.3.0/causal_testing/estimation/cubic_spline_estimator.py +0 -92
- causal_testing_framework-14.3.0/causal_testing/main.py +0 -639
- causal_testing_framework-14.3.0/causal_testing/specification/scenario.py +0 -40
- causal_testing_framework-14.3.0/causal_testing/specification/variable.py +0 -90
- causal_testing_framework-14.3.0/causal_testing/surrogate/causal_surrogate_assisted.py +0 -152
- causal_testing_framework-14.3.0/causal_testing/surrogate/surrogate_search_algorithms.py +0 -120
- causal_testing_framework-14.3.0/causal_testing/testing/base_test_case.py +0 -24
- causal_testing_framework-14.3.0/causal_testing/testing/causal_effect.py +0 -147
- causal_testing_framework-14.3.0/causal_testing/testing/causal_test_adequacy.py +0 -125
- causal_testing_framework-14.3.0/causal_testing/testing/causal_test_case.py +0 -76
- causal_testing_framework-14.3.0/causal_testing/testing/causal_test_result.py +0 -71
- causal_testing_framework-14.3.0/causal_testing/testing/metamorphic_relation.py +0 -305
- causal_testing_framework-14.3.0/causal_testing_framework.egg-info/scm_version.json +0 -8
- causal_testing_framework-14.3.0/docs/source/background.rst +0 -109
- causal_testing_framework-14.3.0/docs/source/glossary.rst +0 -57
- causal_testing_framework-14.3.0/docs/source/index.rst +0 -136
- causal_testing_framework-14.3.0/docs/source/installation.rst +0 -147
- causal_testing_framework-14.3.0/docs/source/modules/causal_specification.rst +0 -121
- causal_testing_framework-14.3.0/docs/source/modules/causal_testing.rst +0 -164
- causal_testing_framework-14.3.0/docs/source/modules/custom_estimators.rst +0 -65
- causal_testing_framework-14.3.0/docs/source/modules/estimators.rst +0 -90
- causal_testing_framework-14.3.0/docs/source/tutorials/vaccinating_elderly/causal_test_results.json +0 -260
- causal_testing_framework-14.3.0/docs/source/tutorials/visualising_causal_test_results/visualise_causal_test_results.ipynb +0 -264
- causal_testing_framework-14.3.0/docs/source/tutorials.rst +0 -13
- causal_testing_framework-14.3.0/examples/covasim_/vaccinating_elderly/example_vaccine.py +0 -93
- causal_testing_framework-14.3.0/images/.gitignore +0 -3
- causal_testing_framework-14.3.0/images/schematic-dark.png +0 -0
- causal_testing_framework-14.3.0/images/schematic.png +0 -0
- causal_testing_framework-14.3.0/images/schematic.tex +0 -154
- causal_testing_framework-14.3.0/tests/__init__.py +0 -0
- causal_testing_framework-14.3.0/tests/estimation_tests/test_cubic_spline_estimator.py +0 -34
- causal_testing_framework-14.3.0/tests/estimation_tests/test_ipcw_estimator.py +0 -94
- causal_testing_framework-14.3.0/tests/estimation_tests/test_logistic_regression_estimator.py +0 -32
- causal_testing_framework-14.3.0/tests/main_tests/test_main.py +0 -635
- causal_testing_framework-14.3.0/tests/resources/data/data.csv +0 -6
- causal_testing_framework-14.3.0/tests/resources/data/data.pqt +0 -0
- causal_testing_framework-14.3.0/tests/resources/data/data_with_meta.csv +0 -2
- causal_testing_framework-14.3.0/tests/resources/data/tests.json +0 -26
- causal_testing_framework-14.3.0/tests/specification_tests/test_variable.py +0 -29
- causal_testing_framework-14.3.0/tests/surrogate_tests/test_causal_surrogate_assisted.py +0 -243
- causal_testing_framework-14.3.0/tests/testing_tests/test_causal_effect.py +0 -310
- causal_testing_framework-14.3.0/tests/testing_tests/test_causal_test_case.py +0 -250
- causal_testing_framework-14.3.0/tests/testing_tests/test_metamorphic_relations.py +0 -331
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/.github/workflows/figshare.yaml +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/.github/workflows/joss.yaml +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/.github/workflows/lint-format.yaml +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/.github/workflows/publish-to-dafni.yaml +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/.github/workflows/publish-to-pypi.yaml +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/.gitignore +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/.mega-linter.yaml +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/.pylintrc +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/.readthedocs.yaml +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/CITATION.cff +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/CONTRIBUTING.md +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/LICENSE +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/causal_testing/__init__.py +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/causal_testing/discovery/__init__.py +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/causal_testing/estimation/__init__.py +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/causal_testing/estimation/effect_estimate.py +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/causal_testing/estimation/genetic_programming_regression_fitter.py +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/causal_testing/specification/__init__.py +0 -0
- {causal_testing_framework-14.3.0/causal_testing/surrogate → causal_testing_framework-15.0.0/causal_testing/testing}/__init__.py +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/causal_testing/testing/effect.py +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/causal_testing/testing/intervention.py +0 -0
- {causal_testing_framework-14.3.0/causal_testing/testing → causal_testing_framework-15.0.0/causal_testing/utils}/__init__.py +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/causal_testing/utils/validation.py +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/causal_testing_framework.egg-info/dependency_links.txt +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/causal_testing_framework.egg-info/entry_points.txt +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/codecov.yml +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/dafni/.dockerignore +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/dafni/.env +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/dafni/Dockerfile +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/dafni/README.md +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/dafni/data/inputs/causal-tests/causal_tests.json +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/dafni/data/inputs/dag-data/dag.dot +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/dafni/data/inputs/runtime-data/runtime_data.csv +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/dafni/data/outputs/causal_test_results.json +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/dafni/docker-compose.yaml +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/dafni/entrypoint.sh +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/dafni/model_definition.yaml +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/docs/Makefile +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/docs/README.md +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/docs/make.bat +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/docs/source/_static/css/custom.css +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/docs/source/_static/images/CITCOM-logo-white.png +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/docs/source/_static/images/CITCOM-logo.png +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/docs/source/_static/images/Sheffield-logo.png +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/docs/source/_static/images/example_dag.png +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/docs/source/credits.rst +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/docs/source/dev/actions_and_webhooks.rst +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/docs/source/dev/documentation.rst +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/docs/source/dev/version_release.rst +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/docs/source/requirements.txt +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/docs/source/tutorials/poisson_line_process/causal_tests.json +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/docs/source/tutorials/poisson_line_process/dag.dot +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/docs/source/tutorials/poisson_line_process/dag.png +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/docs/source/tutorials/poisson_line_process/data/random/data_random_1000.csv +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/docs/source/tutorials/vaccinating_elderly/dag.dot +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/docs/source/tutorials/vaccinating_elderly/dag_image.png +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/docs/source/tutorials/vaccinating_elderly/simulated_data.csv +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/examples/.gitignore +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/examples/covasim_/doubling_beta/README.md +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/examples/covasim_/doubling_beta/dag.dot +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/examples/covasim_/doubling_beta/dag.png +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/examples/covasim_/doubling_beta/data/10k_observational_data.csv +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/examples/covasim_/doubling_beta/data/high_contacts_avg_age_22.2.csv +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/examples/covasim_/doubling_beta/data/high_contacts_avg_age_30.1.csv +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/examples/covasim_/doubling_beta/data/low_contacts_avg_age_22.2.csv +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/examples/covasim_/doubling_beta/data/low_contacts_avg_age_30.1.csv +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/examples/covasim_/doubling_beta/data/older_population.csv +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/examples/covasim_/doubling_beta/data/younger_population.csv +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/examples/covasim_/vaccinating_elderly/README.md +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/examples/covasim_/vaccinating_elderly/dag.dot +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/examples/covasim_/vaccinating_elderly/dag.png +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/examples/covasim_/vaccinating_elderly/simulated_data.csv +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/examples/lr91/README.md +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/examples/lr91/dag.dot +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/examples/lr91/dag.png +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/examples/lr91/data/normalised_results.csv +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/examples/lr91/data/results.csv +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/examples/poisson-line-process/.gitignore +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/examples/poisson-line-process/README.md +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/examples/poisson-line-process/causal_tests.json +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/examples/poisson-line-process/dag.dot +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/examples/poisson-line-process/dag.png +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/examples/poisson-line-process/data/random/data_random_1000.csv +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/examples/poisson-line-process/data/smt_100/data_smt_wh10_100.csv +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/examples/poisson-line-process/data/smt_100/data_smt_wh1_100.csv +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/examples/poisson-line-process/data/smt_100/data_smt_wh2_100.csv +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/examples/poisson-line-process/data/smt_100/data_smt_wh3_100.csv +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/examples/poisson-line-process/data/smt_100/data_smt_wh4_100.csv +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/examples/poisson-line-process/data/smt_100/data_smt_wh5_100.csv +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/examples/poisson-line-process/data/smt_100/data_smt_wh6_100.csv +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/examples/poisson-line-process/data/smt_100/data_smt_wh7_100.csv +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/examples/poisson-line-process/data/smt_100/data_smt_wh8_100.csv +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/examples/poisson-line-process/data/smt_100/data_smt_wh9_100.csv +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/examples/poisson-line-process/poisson_line_process.ipynb +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/paper/paper.bib +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/setup.cfg +0 -0
- {causal_testing_framework-14.3.0/causal_testing/utils → causal_testing_framework-15.0.0/tests}/__init__.py +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/tests/resources/data/dag.dot +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/tests/resources/data/dag.xml +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/tests/resources/data/data_with_categorical.csv +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/tests/resources/data/exclude_edges.dot +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/tests/resources/data/include_edges.dot +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/tests/resources/data/nhefs.csv +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/tests/resources/data/scarf_data.csv +0 -0
- {causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/tests/resources/data/temporal_data.csv +0 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
## Checklist
|
|
2
|
+
Before you mark your PR as ready for review, please ensure you have completed the following.
|
|
3
|
+
|
|
4
|
+
- [ ] Added unit tests for new functionality
|
|
5
|
+
- [ ] Properly documented any new code
|
|
6
|
+
- [ ] Updated Sphinx documentation in `docs/` and checked for updated configuration/runtime options
|
|
7
|
+
- [ ] Added a jupyter notebook tutorial in `docs/source/tutorials` for any new functionality
|
|
8
|
+
- [ ] Verified local docs build with `sphinx-build -W source/ build`
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
name: Build docs
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
build:
|
|
10
|
+
name: MegaLinter
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- name: Checkout repository
|
|
14
|
+
uses: actions/checkout@v4
|
|
15
|
+
- name: Set up Pandoc
|
|
16
|
+
uses: pandoc/actions/setup@v1
|
|
17
|
+
- name: Set up Python
|
|
18
|
+
uses: actions/setup-python@v5
|
|
19
|
+
with:
|
|
20
|
+
python-version: 3.12
|
|
21
|
+
- name: Install dependencies
|
|
22
|
+
run: |
|
|
23
|
+
python --version
|
|
24
|
+
python -m pip install --upgrade pip
|
|
25
|
+
pip install -e .[dev]
|
|
26
|
+
- name: "Build docs"
|
|
27
|
+
working-directory: "docs"
|
|
28
|
+
run: |
|
|
29
|
+
sphinx-build -W source/ build
|
|
@@ -3,31 +3,31 @@ repos:
|
|
|
3
3
|
rev: v6.0.0
|
|
4
4
|
hooks:
|
|
5
5
|
- id: trailing-whitespace
|
|
6
|
-
files: ^causal_testing/
|
|
6
|
+
files: ^(causal_testing|tests)/
|
|
7
7
|
- id: end-of-file-fixer
|
|
8
|
-
files: ^causal_testing/
|
|
8
|
+
files: ^(causal_testing|tests)/
|
|
9
9
|
- id: check-added-large-files
|
|
10
|
-
files: ^causal_testing/
|
|
10
|
+
files: ^(causal_testing|tests)/
|
|
11
11
|
- id: check-merge-conflict
|
|
12
|
-
files: ^causal_testing/
|
|
12
|
+
files: ^(causal_testing|tests)/
|
|
13
13
|
- id: debug-statements
|
|
14
|
-
files: ^causal_testing/
|
|
14
|
+
files: ^(causal_testing|tests)/
|
|
15
15
|
- id: mixed-line-ending
|
|
16
|
-
files: ^causal_testing/
|
|
16
|
+
files: ^(causal_testing|tests)/
|
|
17
17
|
|
|
18
18
|
- repo: https://github.com/psf/black
|
|
19
19
|
rev: 25.9.0
|
|
20
20
|
hooks:
|
|
21
21
|
- id: black
|
|
22
22
|
args: ['--line-length=120', '--target-version=py311']
|
|
23
|
-
files: ^causal_testing/
|
|
23
|
+
files: ^(causal_testing|tests)/
|
|
24
24
|
|
|
25
25
|
- repo: https://github.com/pycqa/isort
|
|
26
26
|
rev: 7.0.0
|
|
27
27
|
hooks:
|
|
28
28
|
- id: isort
|
|
29
29
|
args: ['--profile', 'black', '--line-length', '120']
|
|
30
|
-
files: ^causal_testing/
|
|
30
|
+
files: ^(causal_testing|tests)/
|
|
31
31
|
|
|
32
32
|
- repo: local
|
|
33
33
|
hooks:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: causal_testing_framework
|
|
3
|
-
Version:
|
|
3
|
+
Version: 15.0.0
|
|
4
4
|
Summary: A framework for causal testing using causal directed acyclic graphs.
|
|
5
5
|
Author: The CITCOM team
|
|
6
6
|
License: MIT
|
|
@@ -20,7 +20,7 @@ Requires-Dist: scikit_learn~=1.4
|
|
|
20
20
|
Requires-Dist: scipy<=1.17.1,>=1.12.0
|
|
21
21
|
Requires-Dist: statsmodels~=0.14
|
|
22
22
|
Requires-Dist: tabulate~=0.9
|
|
23
|
-
Requires-Dist: pydot
|
|
23
|
+
Requires-Dist: pydot>=2.0
|
|
24
24
|
Requires-Dist: pygad~=3.3
|
|
25
25
|
Requires-Dist: deap~=1.4.1
|
|
26
26
|
Requires-Dist: sympy~=1.14.0
|
|
@@ -44,10 +44,9 @@ Requires-Dist: ipykernel; extra == "dev"
|
|
|
44
44
|
Requires-Dist: pandoc; extra == "dev"
|
|
45
45
|
Requires-Dist: pre-commit; extra == "dev"
|
|
46
46
|
Requires-Dist: tox; extra == "dev"
|
|
47
|
-
|
|
48
|
-
Requires-Dist:
|
|
49
|
-
Requires-Dist:
|
|
50
|
-
Requires-Dist: ipykernel; extra == "test"
|
|
47
|
+
Requires-Dist: nbclient; extra == "dev"
|
|
48
|
+
Requires-Dist: nbformat; extra == "dev"
|
|
49
|
+
Requires-Dist: ipykernel; extra == "dev"
|
|
51
50
|
Dynamic: license-file
|
|
52
51
|
|
|
53
52
|
# Causal Testing Framework
|
|
@@ -73,8 +72,8 @@ the inputs and outputs of the system under test, supported by mathematical found
|
|
|
73
72
|
enable causal inference. Each causal test case targets the causal effect of a specific intervention on the system under test--that is,
|
|
74
73
|
a deliberate modification to the input configuration expected to produce a corresponding change in one or more outputs.
|
|
75
74
|
|
|
76
|
-

|
|
76
|
+

|
|
78
77
|
|
|
79
78
|
## Installation
|
|
80
79
|
|
|
@@ -21,8 +21,8 @@ the inputs and outputs of the system under test, supported by mathematical found
|
|
|
21
21
|
enable causal inference. Each causal test case targets the causal effect of a specific intervention on the system under test--that is,
|
|
22
22
|
a deliberate modification to the input configuration expected to produce a corresponding change in one or more outputs.
|
|
23
23
|
|
|
24
|
-

|
|
25
|
+

|
|
26
26
|
|
|
27
27
|
## Installation
|
|
28
28
|
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
"""This module contains the main entrypoint functionality to the Causal Testing Framework."""
|
|
2
|
+
|
|
3
|
+
import argparse
|
|
4
|
+
import json
|
|
5
|
+
import logging
|
|
6
|
+
from enum import Enum
|
|
7
|
+
from importlib.metadata import entry_points
|
|
8
|
+
from typing import Optional, Sequence
|
|
9
|
+
from warnings import warn
|
|
10
|
+
|
|
11
|
+
import networkx as nx
|
|
12
|
+
import pandas as pd
|
|
13
|
+
|
|
14
|
+
from causal_testing.causal_testing_framework import CausalTestingFramework, read_dataframe
|
|
15
|
+
from causal_testing.specification.causal_dag import CausalDAG
|
|
16
|
+
|
|
17
|
+
logger = logging.getLogger(__name__)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class Command(Enum):
|
|
21
|
+
"""
|
|
22
|
+
Enum for supported CTF commands.
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
TEST = "test"
|
|
26
|
+
GENERATE = "generate"
|
|
27
|
+
DISCOVER = "discover"
|
|
28
|
+
EVALUATE = "evaluate"
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def setup_logging(level: str) -> None:
|
|
32
|
+
"""Set up logging configuration."""
|
|
33
|
+
logging.basicConfig(
|
|
34
|
+
level=level, format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", datefmt="%Y-%m-%d %H:%M:%S"
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def parse_args(args: Optional[Sequence[str]] = None) -> argparse.Namespace:
|
|
39
|
+
"""Parse command line arguments."""
|
|
40
|
+
main_parser = argparse.ArgumentParser(
|
|
41
|
+
add_help=True,
|
|
42
|
+
description="Causal Testing Framework - "
|
|
43
|
+
"A causal inference-driven framework for functional black-box testing of complex software.",
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
subparsers = main_parser.add_subparsers(
|
|
47
|
+
help="The action you want to run - call `causal_testing {action} -h` for further details", dest="command"
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
# Generation
|
|
51
|
+
parser_generate = subparsers.add_parser(Command.GENERATE.value, help="Generate causal tests from a DAG")
|
|
52
|
+
parser_generate.add_argument("-D", "--dag-path", help="Path to the DAG file (.dot)", required=True)
|
|
53
|
+
parser_generate.add_argument("-o", "--output", help="Path for output file (.json)", required=True)
|
|
54
|
+
parser_generate.add_argument(
|
|
55
|
+
"-i", "--ignore-cycles", help="Ignore cycles in DAG", action="store_true", default=False
|
|
56
|
+
)
|
|
57
|
+
parser_generate.add_argument(
|
|
58
|
+
"--threads", "-t", type=int, help="The number of parallel threads to use.", required=False, default=0
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
# Testing
|
|
62
|
+
parser_test = subparsers.add_parser(Command.TEST.value, help="Run causal tests")
|
|
63
|
+
parser_test.add_argument("-D", "--dag-path", help="Path to the DAG file (.dot)", required=True)
|
|
64
|
+
parser_test.add_argument("-o", "--output", help="Path for output file (.json)", required=True)
|
|
65
|
+
parser_test.add_argument("-i", "--ignore-cycles", help="Ignore cycles in DAG", action="store_true", default=False)
|
|
66
|
+
parser_test.add_argument("-t", "--test-config", help="Path to test configuration file (.json)", required=True)
|
|
67
|
+
parser_test.add_argument("-q", "--query", help="Query string to filter data (e.g. 'age > 18')", type=str)
|
|
68
|
+
parser_test.add_argument(
|
|
69
|
+
"-A", "--adequacy", help="Calculate causal test adequacy for each test case", action="store_true", default=False
|
|
70
|
+
)
|
|
71
|
+
parser_test.add_argument(
|
|
72
|
+
"-b",
|
|
73
|
+
"--adequacy-bootstrap-size",
|
|
74
|
+
dest="bootstrap_size",
|
|
75
|
+
help="Number of bootstrap samples for causal test adequacy. Defaults to 100",
|
|
76
|
+
type=int,
|
|
77
|
+
)
|
|
78
|
+
parser_test.add_argument(
|
|
79
|
+
"-s",
|
|
80
|
+
"--silent",
|
|
81
|
+
action="store_true",
|
|
82
|
+
help="Do not crash on error. If set to true, errors are recorded as test results.",
|
|
83
|
+
default=False,
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
# DAG evaluation
|
|
87
|
+
parser_evaluate = subparsers.add_parser(
|
|
88
|
+
Command.EVALUATE.value, help="Evaluate how well a causal DAG fits a dataset"
|
|
89
|
+
)
|
|
90
|
+
parser_evaluate.add_argument("-D", "--dag-path", help="Path to the DAG file (.dot)", required=True)
|
|
91
|
+
parser_evaluate.add_argument("-o", "--output", help="Path for output file (.csv)", required=True)
|
|
92
|
+
parser_evaluate.add_argument(
|
|
93
|
+
"-i", "--ignore-cycles", help="Ignore cycles in DAG", action="store_true", default=False
|
|
94
|
+
)
|
|
95
|
+
parser_evaluate.add_argument("-q", "--query", help="Query string to filter data (e.g. 'age > 18')", type=str)
|
|
96
|
+
parser_evaluate.add_argument(
|
|
97
|
+
"-b",
|
|
98
|
+
"--adequacy-bootstrap-size",
|
|
99
|
+
dest="bootstrap_size",
|
|
100
|
+
help="Number of bootstrap samples for causal test adequacy. Defaults to 100",
|
|
101
|
+
type=int,
|
|
102
|
+
default=100,
|
|
103
|
+
)
|
|
104
|
+
parser_evaluate.add_argument(
|
|
105
|
+
"-s",
|
|
106
|
+
"--silent",
|
|
107
|
+
action="store_true",
|
|
108
|
+
help="Do not crash on error. If set to true, errors are recorded as test results.",
|
|
109
|
+
default=False,
|
|
110
|
+
)
|
|
111
|
+
parser_evaluate.add_argument("-t", "--test-config", help="Path to test configuration file (.json)")
|
|
112
|
+
|
|
113
|
+
# Discovery
|
|
114
|
+
parser_discover = subparsers.add_parser(Command.DISCOVER.value, help="Discover causal structures from data")
|
|
115
|
+
parser_discover.add_argument(
|
|
116
|
+
"-t",
|
|
117
|
+
"--technique",
|
|
118
|
+
default="HillClimberDiscovery",
|
|
119
|
+
help=(
|
|
120
|
+
"The name of the technique to use. Currently supported are 'HillClimberDiscovery' and 'NSGADiscovery'. "
|
|
121
|
+
"Defaults to HillClimberDiscovery."
|
|
122
|
+
),
|
|
123
|
+
)
|
|
124
|
+
parser_discover.add_argument(
|
|
125
|
+
"-V",
|
|
126
|
+
"--variables",
|
|
127
|
+
help="The subset of variables from the data to consider. Defaults to all.",
|
|
128
|
+
nargs="*",
|
|
129
|
+
default=[],
|
|
130
|
+
)
|
|
131
|
+
parser_discover.add_argument("-o", "--output", help="Path for output DAG file (.dot)", required=True)
|
|
132
|
+
parser_discover.add_argument(
|
|
133
|
+
"-i", "--include-edges", help="Path to file containing edges to include", required=False
|
|
134
|
+
)
|
|
135
|
+
parser_discover.add_argument(
|
|
136
|
+
"-e", "--exclude-edges", help="Path to file containing edges to exclude", required=False
|
|
137
|
+
)
|
|
138
|
+
parser_discover.add_argument(
|
|
139
|
+
"--technique-kwargs",
|
|
140
|
+
help="Keywords for the discovery technique. These should be specified as `arg1=value1 arg2=value2...`.",
|
|
141
|
+
nargs="*",
|
|
142
|
+
default=[],
|
|
143
|
+
)
|
|
144
|
+
|
|
145
|
+
for parser in [parser_generate, parser_discover, parser_test, parser_evaluate]:
|
|
146
|
+
parser.add_argument(
|
|
147
|
+
"-l",
|
|
148
|
+
"--log_level",
|
|
149
|
+
default="WARNING",
|
|
150
|
+
type=str.upper,
|
|
151
|
+
choices=["NONE", "DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"],
|
|
152
|
+
help="Set the logging level (default: WARNING).",
|
|
153
|
+
)
|
|
154
|
+
parser.add_argument(
|
|
155
|
+
"-a",
|
|
156
|
+
"--alpha",
|
|
157
|
+
help=(
|
|
158
|
+
"The significance level of the confidence intervals used to determine causality. "
|
|
159
|
+
"This should be a value between 0 and 1. Defaults to 0.05 for 95%% confidence intervals."
|
|
160
|
+
),
|
|
161
|
+
default=0.05,
|
|
162
|
+
)
|
|
163
|
+
parser.add_argument("-d", "--data-paths", help="Paths to data files (.csv)", nargs="+", required=True)
|
|
164
|
+
|
|
165
|
+
args = main_parser.parse_args(args)
|
|
166
|
+
|
|
167
|
+
# Assume the user wants test adequacy if they're setting bootstrap_size
|
|
168
|
+
if getattr(args, "bootstrap_size", None) is not None:
|
|
169
|
+
args.adequacy = True
|
|
170
|
+
if getattr(args, "adequacy", False) and getattr(args, "bootstrap_size", None) is None:
|
|
171
|
+
# Need this here rather than a default value because otherwise the above always sets adequacy to True
|
|
172
|
+
args.bootstrap_size = 100
|
|
173
|
+
|
|
174
|
+
args.command = Command(args.command)
|
|
175
|
+
return args
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
def main() -> None:
|
|
179
|
+
"""
|
|
180
|
+
|
|
181
|
+
Main entry point for the Causal Testing Framework
|
|
182
|
+
|
|
183
|
+
"""
|
|
184
|
+
|
|
185
|
+
# Parse arguments
|
|
186
|
+
args = parse_args()
|
|
187
|
+
# Setup logging
|
|
188
|
+
setup_logging(args.log_level)
|
|
189
|
+
|
|
190
|
+
match args.command:
|
|
191
|
+
case Command.GENERATE:
|
|
192
|
+
logging.info("Generating causal tests")
|
|
193
|
+
df = pd.concat(read_dataframe(path) for path in args.data_paths)
|
|
194
|
+
causal_dag = CausalDAG(args.dag_path, ignore_cycles=args.ignore_cycles, datatypes=df.dtypes)
|
|
195
|
+
causal_tests = causal_dag.generate_causal_tests(
|
|
196
|
+
threads=args.threads,
|
|
197
|
+
skip=False,
|
|
198
|
+
)
|
|
199
|
+
with open(args.output, "w", encoding="utf-8") as f:
|
|
200
|
+
json.dump({"tests": [test.to_dict() for test in causal_tests]}, f)
|
|
201
|
+
logging.info("Causal test generation completed successfully.")
|
|
202
|
+
|
|
203
|
+
case Command.DISCOVER:
|
|
204
|
+
discover_map = {ff.name: ff for ff in entry_points(group="discovery")}
|
|
205
|
+
if args.technique not in discover_map:
|
|
206
|
+
raise ValueError(
|
|
207
|
+
f"Unsupported technique {args.technique}. Supported: {sorted(discover_map)}. "
|
|
208
|
+
"If you have implemented a custom technique, you will need to add this to your entrypoints via "
|
|
209
|
+
"your pyproject.toml file."
|
|
210
|
+
)
|
|
211
|
+
kwargs = {}
|
|
212
|
+
for argument in args.technique_kwargs:
|
|
213
|
+
split = argument.split("=")
|
|
214
|
+
if len(split) != 2:
|
|
215
|
+
raise ValueError(f"Malformed argument {argument}. Should be specified as `arg_name=arg_value`")
|
|
216
|
+
kwargs[split[0]] = split[1]
|
|
217
|
+
|
|
218
|
+
logging.info("Discovering causal structure")
|
|
219
|
+
# Need to reset index to allow for multiple files having the same index (i.e. starting at zero).
|
|
220
|
+
# Otherwise you end up with duplicate indices, which causes problems further down the line
|
|
221
|
+
df = pd.concat([read_dataframe(path) for path in args.data_paths]).reset_index(drop=True)
|
|
222
|
+
if args.variables:
|
|
223
|
+
df = df[args.variables]
|
|
224
|
+
# Drop unnamed columns
|
|
225
|
+
unnamed_columns = [c for c in df.columns if c.startswith("Unnamed: ")]
|
|
226
|
+
if unnamed_columns:
|
|
227
|
+
warn(f"Dropping unnamed columns: {unnamed_columns}")
|
|
228
|
+
df = df.drop(unnamed_columns, axis=1)
|
|
229
|
+
|
|
230
|
+
discover_class = discover_map[args.technique].load()
|
|
231
|
+
discover = discover_class(
|
|
232
|
+
df=df,
|
|
233
|
+
exclude_edges=(
|
|
234
|
+
list(nx.nx_pydot.read_dot(args.exclude_edges).edges()) if args.exclude_edges is not None else []
|
|
235
|
+
),
|
|
236
|
+
include_edges=(
|
|
237
|
+
list(nx.nx_pydot.read_dot(args.include_edges).edges()) if args.include_edges is not None else []
|
|
238
|
+
),
|
|
239
|
+
alpha=args.alpha,
|
|
240
|
+
**kwargs,
|
|
241
|
+
)
|
|
242
|
+
evolved_dag = discover.discover()
|
|
243
|
+
if args.output is not None:
|
|
244
|
+
nx.drawing.nx_pydot.write_dot(evolved_dag, args.output)
|
|
245
|
+
logging.info("Causal structure discovery completed successfully.")
|
|
246
|
+
case Command.TEST:
|
|
247
|
+
# Create and setup framework
|
|
248
|
+
framework = CausalTestingFramework()
|
|
249
|
+
|
|
250
|
+
framework.setup(
|
|
251
|
+
dag_path=args.dag_path,
|
|
252
|
+
data_paths=args.data_paths,
|
|
253
|
+
test_cases_path=args.test_config,
|
|
254
|
+
query=args.query,
|
|
255
|
+
ignore_cycles=args.ignore_cycles,
|
|
256
|
+
)
|
|
257
|
+
|
|
258
|
+
logging.info("Running tests")
|
|
259
|
+
framework.run_tests(silent=args.silent, adequacy=args.adequacy, bootstrap_size=args.bootstrap_size)
|
|
260
|
+
framework.save_results(args.output)
|
|
261
|
+
|
|
262
|
+
logging.info("Causal testing completed successfully.")
|
|
263
|
+
case Command.EVALUATE:
|
|
264
|
+
# Create and setup framework
|
|
265
|
+
framework = CausalTestingFramework()
|
|
266
|
+
framework.load_data(args.data_paths, query=args.query)
|
|
267
|
+
framework.load_dag(args.dag_path, args.ignore_cycles)
|
|
268
|
+
framework.dag.datatypes = framework.df.dtypes
|
|
269
|
+
|
|
270
|
+
if args.test_config:
|
|
271
|
+
framework.load_test_cases_from_json(args.test_config)
|
|
272
|
+
else:
|
|
273
|
+
framework.test_cases = framework.dag.generate_causal_tests()
|
|
274
|
+
|
|
275
|
+
logging.info("Running tests on entire dataset")
|
|
276
|
+
results = framework.evaluate_dag(alpha=args.alpha, bootstrap_size=args.bootstrap_size)
|
|
277
|
+
logging.info("Causal testing completed successfully.")
|
|
278
|
+
logging.info("Running tests on bootstrap samples")
|
|
279
|
+
results.to_csv(args.output)
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
if __name__ == "__main__":
|
|
283
|
+
main()
|
{causal_testing_framework-14.3.0 → causal_testing_framework-15.0.0}/causal_testing/_version.py
RENAMED
|
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
|
|
|
18
18
|
commit_id: str | None
|
|
19
19
|
__commit_id__: str | None
|
|
20
20
|
|
|
21
|
-
__version__ = version = '
|
|
22
|
-
__version_tuple__ = version_tuple = (
|
|
21
|
+
__version__ = version = '15.0.0'
|
|
22
|
+
__version_tuple__ = version_tuple = (15, 0, 0)
|
|
23
23
|
|
|
24
|
-
__commit_id__ = commit_id = '
|
|
24
|
+
__commit_id__ = commit_id = 'g9ee3e7c92'
|