Skip to content

add moment for BART distribution #5211

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

Merged
merged 2 commits into from
Nov 20, 2021
Merged

Conversation

aloctavodia
Copy link
Member

Following discussion in #5078

@codecov
Copy link

codecov bot commented Nov 19, 2021

Codecov Report

Merging #5211 (eb77473) into main (90423a9) will decrease coverage by 0.13%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #5211      +/-   ##
==========================================
- Coverage   78.12%   77.98%   -0.14%     
==========================================
  Files          88       88              
  Lines       14174    14227      +53     
==========================================
+ Hits        11073    11095      +22     
- Misses       3101     3132      +31     
Impacted Files Coverage Δ
pymc/bart/bart.py 95.91% <100.00%> (+0.46%) ⬆️
pymc/sampling_jax.py 0.00% <0.00%> (ø)
pymc/backends/arviz.py 89.55% <0.00%> (ø)
pymc/distributions/discrete.py 98.35% <0.00%> (+0.02%) ⬆️
pymc/distributions/continuous.py 96.57% <0.00%> (+0.02%) ⬆️
pymc/distributions/simulator.py 86.76% <0.00%> (+0.50%) ⬆️

@@ -132,6 +137,13 @@ def logp(x, *inputs):
"""
return at.zeros_like(x)

@classmethod
def get_moment(cls, rv, size, *rv_inputs):
Copy link
Member

Choose a reason for hiding this comment

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

Could BART shape be determined by the shape of the rv_inputs? Or does the mean already integrate this info?

Copy link
Member Author

Choose a reason for hiding this comment

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

The shape of BART is always the shape of observed data Y.

Copy link
Member

Choose a reason for hiding this comment

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

And do you do anything with the size variable or is that branch below unnecessary?

Copy link
Member Author

Choose a reason for hiding this comment

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

everything is a lie :-) Initially I tough about having a size argument for future extension. But probably that will not be very useful.

@classmethod
def get_moment(cls, rv, size, *rv_inputs):
mean = rv.Y.mean()
if not rv_size_is_none(size):
Copy link
Member

Choose a reason for hiding this comment

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

Can you add a condition that hits this branch?

@ricardoV94 ricardoV94 mentioned this pull request Nov 19, 2021
51 tasks
@aloctavodia aloctavodia merged commit 45b3339 into pymc-devs:main Nov 20, 2021
@aloctavodia aloctavodia deleted the bart_moment branch November 20, 2021 10:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants