-
Notifications
You must be signed in to change notification settings - Fork 5
Json poisson example #67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Personally, I quite like a class extension, but it is potentially a "barrier to entry". Having said that, if someone can write a complex computational model which requires our testing framework in order to test it effectively, they should be able to manage extending a class... |
That is probably very true, if they can jump every barrier up to the point of using the framework, one class extension hopefully won't stop them! I'll create the class extension and then if needed, we can always discuss again when it's in front of us |
Codecov Report
@@ Coverage Diff @@
## main #67 +/- ##
==========================================
- Coverage 86.95% 76.98% -9.98%
==========================================
Files 12 13 +1
Lines 820 934 +114
==========================================
+ Hits 713 719 +6
- Misses 107 215 +108
Continue to review full report at Codecov.
|
How would it be if https://github.com/CITCOM-project/CausalTestingFramework/blob/json_poisson_example/json_frontend/process_causal_tests_json.py were moved into |
Go ahead. I have no strong opinions... |
Sounds good to me @bobturneruk, it could be overlooked in its current structure |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. It would be great to see json_frontend/process_causal_tests_json.py
brought into the package and the example moved into the folder with the other examples. Please ignore the codacy notes. I think codecov and github are having some interaction problems. Tests for json_frontend/process_causal_tests_json.py
should be added later.
When I run it, I'm getting a bunch of errors of the form
Not a very helpful stack trace, but please can you look into this? |
Very unhelpful stack trace I agree.. I just tried again with a fresh conda environment with the latest CTF from main branch and it worked okay. When did you last update the CTF in your conda env? |
Thursday |
Changed the backslashes to forward slashes in filepaths
@@ -0,0 +1,32 @@ | |||
# JSON Causal Testing Framework Frontend |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file is going to be a bit tricky to find here in the package. It might be better merged with the main readme for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be a good idea to move this readme to the readthedocs and point to it from the main readme?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would also work. Examples / tutorials should be prominent.
4. Meta constraint functions | ||
5. Mapping JSON distributions, effects, and estimators to python objects | ||
|
||
`examples/poisson/causal_tests.json` is the JSON file that allows for the easy specification of multiple causal tests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll need quite a bit more instruction for anyone not already familiar with the package to use this. I suggest making an issue to keep track of this. It could be that a jupyter notebook is is a good next step.
description="A script for parsing json config files for the Causal Testing Framework") | ||
parser.add_argument("-f", help="if included, the script will stop if a test fails", | ||
action="store_true") | ||
parser.add_argument("--directory_path", help="path to the json file containing the causal tests", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure the default will work here, as it's supposed to be setting a folder / directory, not a specific file. And the filenames are hardcoded elsewhere (in causal_testing/json_front/json_class.py
). Maybe get rid of the CLI arg and look for files in the same folder as the script for now? Or get rid of the default value? We may want to look at this again after merging, depending on expected user needs around file locations and naming. I would have thought that, at least, not everyone would want to call their data data.csv
which I think is the current requirement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right. I think now that the door has been opened in terms of the user writing more python code, the simplest approach is expect the user to specify the paths in causal_test_setup.py
. This way the file names and locations are completely flexible and up to the user
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this looks good. I'd like to get a deeper understanding and maybe a simpler example / more documentation / a jupyter notebook implementation will help with this once merged. I wonder if some things might be named differently. Maybe "json interface" is better than "json frontend"? And perhaps causal_test_setup.py
could be run_causal_tests.py
?
Generally liking how all the example specific stuff is in examples/poisson
now.
setup.py
Outdated
] | ||
|
||
setup( | ||
name="causal_testing_framework", | ||
version="0.0.1", | ||
install_requires=requirements, | ||
packages=find_packages(), | ||
entry_points={ | ||
'console_scripts': [ | ||
'run_json = causal_testing.json_frontend:main' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this, but is it used in any of the current examples?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for spotting this, I was using this method before we swapped the main function from being in json_class.py
to causal_test_setup.py
. Now that the main function is in a script that the user is free to put and call from where they want, I'm not sure if there is a way to have an entry point to the main function.
Ill remove these lines for now
I think a discussion around the usability of https://github.com/CITCOM-project/CausalTestingFramework/blob/json_poisson_example/json_frontend/examples/poisson/causal_test_setup.py would be useful.
Currently the frontend assumes you correctly structure the custom user python code as per the example which isn't ideal. The obvious alternative to me is having a class that can be extended, maybe even an abstract one with properties to enforce it is done correctly. However if we want the framework to be as open as possible to people without python background classes and class extensions might just be another barrier to using it?
Not sure if this is best discussed in a comment or two or with a meeting :)