-
-
Notifications
You must be signed in to change notification settings - Fork 263
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
update truncated/censored notebook to v4 #271
Conversation
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
View / edit / reply to this conversation on ReviewNB ricardoV94 commented on 2022-01-12T06:07:13Z I think in the limit of zero noise, estimates would still be biased for the censored case (but be fine in the truncated one) drbenvincent commented on 2022-01-12T09:02:15Z Good point. Amending this text |
View / edit / reply to this conversation on ReviewNB ricardoV94 commented on 2022-01-12T06:07:13Z This is outdated, since the code shows no potentials anymore. You could says its equivalent to what Censored does, but I would perhaps not refer to potentials anymore |
View / edit / reply to this conversation on ReviewNB twiecki commented on 2022-01-12T06:26:39Z where is that function defined? drbenvincent commented on 2022-01-12T17:19:31Z This reviewnb doesn't show all cells. But it is actually there and defined... def truncated_regression(x, y, bounds): with pm.Model() as model: slope = pm.Normal("slope", mu=0, sigma=1) intercept = pm.Normal("intercept", mu=0, sigma=1) σ = pm.HalfNormal("σ", sigma=1) |
Good point. Amending this text View entire conversation on ReviewNB |
This reviewnb doesn't show all cells. But it is actually there and defined... def truncated_regression(x, y, bounds): with pm.Model() as model: slope = pm.Normal("slope", mu=0, sigma=1) intercept = pm.Normal("intercept", mu=0, sigma=1) σ = pm.HalfNormal("σ", sigma=1) View entire conversation on ReviewNB |
All comments so far have been dealt with. Any other major issues to address? |
View / edit / reply to this conversation on ReviewNB ricardoV94 commented on 2022-01-12T21:08:20Z This paragraph seems to contradict the next one: "is a little more involved" vs "it is really straightforward"
drbenvincent commented on 2022-01-12T22:45:42Z Well spotted. I deleted the whole paragraph as it is no longer true. Not for the user anyway. |
View / edit / reply to this conversation on ReviewNB OriolAbril commented on 2022-01-12T21:27:07Z The target should be
I would also add the tag drbenvincent commented on 2022-01-12T22:44:45Z I did both of these things now.
|
View / edit / reply to this conversation on ReviewNB OriolAbril commented on 2022-01-12T21:27:08Z use drbenvincent commented on 2022-01-12T22:46:08Z I believe I've done this right. Let me know if not. |
View / edit / reply to this conversation on ReviewNB OriolAbril commented on 2022-01-12T21:27:09Z The plot feels a bit strange now. I can try to have a go at in and add an arrow, like in the rectified gaussian from https://en.wikipedia.org/wiki/Rectified_Gaussian_distribution#/media/File:Truncated_Gaussian.jpg. Matplotlib is quite nice with arrows. I probably won't have time to do it until after a couple days though so if someone else can do it go ahead
as a first approximation I think the code would look like:
ax.arrow(-1, 0, -1, .35, color="C1") drbenvincent commented on 2022-01-12T22:47:56Z I know what you mean, but I'm not 100% convinced an arrowhead on top of the line there already would be a big improvement. But I can come back to this if you think it's a big deal ricardoV94 commented on 2022-01-13T04:36:24Z What about a scatter point with a label "truncation bound"? OriolAbril commented on 2022-01-13T05:10:29Z on top of the line there already I meant replacing the spiking like by an arrow, like it's done in the example image (copied below). It's not a strong preference though.
drbenvincent commented on 2022-01-13T12:28:07Z I wasn't sure how to interpret that Ricardo.
Oriol: I might be misunderstanding, but the height of the line/arrow matters, equating to the cumulative density up to the lower bound. So in practice it would look the same as it does now but with an arrow on the top.
Maybe I switch back to a histogram with narrow bins? Although I think it's reasonable as it is |
View / edit / reply to this conversation on ReviewNB OriolAbril commented on 2022-01-12T21:27:10Z There is no need to remove the link to your profile. If other notebooks don't do it is because they didn't and I did not add it, but so far when updating notebooks from other people I have always kept their personal links if they where there. drbenvincent commented on 2022-01-12T22:46:45Z Thanks. Have added links to GitHub profile back in.
|
View / edit / reply to this conversation on ReviewNB OriolAbril commented on 2022-01-12T21:27:10Z very minor nit, can you add a watermark title right above and remove xarray from the drbenvincent commented on 2022-01-12T22:46:58Z Done |
I did both of these things now.
View entire conversation on ReviewNB |
Well spotted. I deleted the whole paragraph as it is no longer true. Not for the user anyway. View entire conversation on ReviewNB |
I believe I've done this right. Let me know if not. View entire conversation on ReviewNB |
Thanks. Have added links to GitHub profile back in.
View entire conversation on ReviewNB |
Done View entire conversation on ReviewNB |
I know what you mean, but I'm not 100% convinced an arrowhead on top of the line there already would be a big improvement. But I can come back to this if you think it's a big deal View entire conversation on ReviewNB |
What about a scatter point with a label "truncation bound"? View entire conversation on ReviewNB |
on top of the line there already I meant replacing the spiking like by an arrow, like it's done in the example image (now copied below). It's not a strong preference though.
View entire conversation on ReviewNB |
I wasn't sure how to interpret that Ricardo.
Oriol: I might be misunderstanding, but the height of the line/arrow matters, equating to the cumulative density up to the lower bound. So in practice it would look the same as it does now but with an arrow on the top.
Maybe I switch back to a histogram with narrow bins? Although I think it's reasonable as it is View entire conversation on ReviewNB |
Just a quick judge to @OriolAbril if I may? Any strong objections to leaving this as it is? |
MIssed the previous response. No objections to leaving the plot as it is.
Again, no opposition to not updating the plot, we can go ahead and merge the notebook as is. It already looks like a spike and that is what matters to me. I do have one nit to add on that comment. I don't think the quoted comment is true though. I think what matters is the area, not the height (which given the 0 width would be infinite) otherwise the pdf woudn't be normalized anymore right? Setting the height to the value of the area (as a rule, not in this case where it already looks like a spike) could be confusing (even end up lower than the rest of the pdf!) if you take the (b) subfigure of the image I shared above for example, the area represented in the spike is 0.5 but its height is ~0.75 because otherwise it would probably look to close to the rest of the pdf. Moreover, if sigma of the normal were lower, then the mode would have higher pdf value: the same censoring at 0 on the After writing that I realize we probably need to update some of the wording on the PR, maybe also the docs? The intuition is still the same: All the probability before/after the bound is concentrated at the bound. But the way to achieve this mathematically is not by setting |
1115044
to
b51882b
Compare
related to #90 |
Following #261, this pull request updates GLM-truncated-censored-regression.ipynb
Changes: