Skip to content
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

Estimator return types #264

Merged
merged 40 commits into from
Feb 28, 2024
Merged

Estimator return types #264

merged 40 commits into from
Feb 28, 2024

Conversation

christopher-wild
Copy link
Contributor

Fetch factors from interaction terms using Patsy ModelDesc class

Copy link

github-actions bot commented Feb 13, 2024

🦙 MegaLinter status: ⚠️ WARNING

Descriptor Linter Files Fixed Errors Elapsed time
⚠️ PYTHON black 29 1 1.32s
✅ PYTHON pylint 29 0 4.71s

See detailed report in MegaLinter reports

MegaLinter is graciously provided by OX Security

@christopher-wild
Copy link
Contributor Author

Added logic to handle both pd.Series and float values for confidence intervals. This is due to the fact that not all estimators return pd.Series and enforcing it on all of them feels awkward

Copy link

codecov bot commented Feb 14, 2024

Codecov Report

Attention: Patch coverage is 97.91667% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 95.59%. Comparing base (d5921c4) to head (b8ad419).
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #264      +/-   ##
==========================================
- Coverage   95.72%   95.59%   -0.13%     
==========================================
  Files          22       22              
  Lines        1566     1567       +1     
==========================================
- Hits         1499     1498       -1     
- Misses         67       69       +2     
Files Coverage Δ
causal_testing/testing/causal_test_outcome.py 96.87% <100.00%> (-0.19%) ⬇️
causal_testing/testing/causal_test_result.py 96.82% <100.00%> (+0.21%) ⬆️
causal_testing/testing/estimators.py 90.32% <100.00%> (-0.04%) ⬇️
...l_testing/surrogate/surrogate_search_algorithms.py 98.38% <75.00%> (-1.62%) ⬇️

... and 1 file with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 66c35ac...b8ad419. Read the comment docs.

@christopher-wild christopher-wild marked this pull request as ready for review February 14, 2024 12:20
@christopher-wild
Copy link
Contributor Author

Different estimators and estimate methods (estimate_ate, estimate_coefficient, estimate_risk_ratio, etc) returning both floats of different kinds (np.float64 and inbuilt float), and pd.Series, has lead to extra conditions being added in causal_test_result.py and causal_test_outcome.py

@christopher-wild christopher-wild changed the title Interaction terms with Patsy Estimator return types Feb 23, 2024
@christopher-wild
Copy link
Contributor Author

I've renamed this PR to be about estimator return types. I think the issue these commits solve is sufficiently different from the interaction terms to be 2 separate PRs at this point.

@@ -46,7 +46,7 @@ def fitness_function(ga, solution, idx): # pylint: disable=unused-argument

ate = surrogate.estimate_ate_calculated(adjustment_dict)

return contradiction_function(ate)
return contradiction_function(ate[0])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a little worried about the scalability of this as it will only work for float values. If you have categorical data types, this will reduce to a binary treatment between the first and second values in alphabetical order. If you really want to only support float values for this, it would be good to have an explicit check for this to make sure that the user is getting what they expect to get.

@christopher-wild christopher-wild marked this pull request as ready for review February 28, 2024 09:00
@christopher-wild christopher-wild merged commit 0d9b1d7 into main Feb 28, 2024
10 checks passed
@christopher-wild christopher-wild deleted the interaction-terms branch February 28, 2024 09:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants