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

Use sigma instead of sd, remove deprecationwarning #4344

Merged
merged 5 commits into from
Dec 26, 2020

Conversation

MarcoGorelli
Copy link
Contributor

No description provided.

@MarcoGorelli MarcoGorelli force-pushed the remove-sd branch 4 times, most recently from 1c8a4f0 to 24d3a1b Compare December 15, 2020 12:09
if sd is not None:
sigma = sd
warnings.warn("sd is deprecated, use sigma instead", DeprecationWarning)

self.mu = mu = tt.as_tensor_variable(floatX(mu))
self.sigma = self.sd = sigma = tt.as_tensor_variable(floatX(sigma))
Copy link
Member

Choose a reason for hiding this comment

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

can remove self.sd as well.

@@ -832,10 +817,7 @@ class HalfNormal(PositiveContinuous):
x = pm.HalfNormal('x', tau=1/15)
"""

def __init__(self, sigma=None, tau=None, sd=None, *args, **kwargs):
if sd is not None:
sigma = sd
Copy link
Member

Choose a reason for hiding this comment

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

Instead of deleting, could you raise an error here and advice using sigma

The reason being that sd was a keyword for a REALLY long time so there are a lot of examples out there in the wild with this keyword.

@twiecki
Copy link
Member

twiecki commented Dec 15, 2020

Is this the right move? Yes. Does it make me uneasy because I know a ton of people are still happily using sd? Also yes. Hmm.

Copy link
Member

@junpenglao junpenglao left a comment

Choose a reason for hiding this comment

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

I advise that instead of removing the Warning, we raise an error with more meaningful message.

@twiecki
Copy link
Member

twiecki commented Dec 15, 2020

I wonder if we should just keep supporting it in an undocumented fashion and just not tell a soul about it. I certainly can keep a secret.

@junpenglao
Copy link
Member

I support nudging user towards the desired behavior, with the aim to eventually removing sd kwargs. How about raising a more meaningful error message?

@fonnesbeck
Copy link
Member

I agree with Thomas: we should just silently allow it to work. I don't think we need error messages, or even warnings, since we are just talking about a parameter naming convention here.

@MarcoGorelli
Copy link
Contributor Author

Sure, makes sense! I'll keep the warning in then, and once pymc-devs/pymc-examples#1 is in we can change sd to sigma in public-facing notebooks

@twiecki
Copy link
Member

twiecki commented Dec 15, 2020

I think we can just remove the warning then but still fix it here in all the NBs.

@michaelosthege michaelosthege added this to the vNext (3.11.0) milestone Dec 15, 2020
@MarcoGorelli MarcoGorelli force-pushed the remove-sd branch 2 times, most recently from a08d6b2 to f2ebb18 Compare December 25, 2020 13:44
@MarcoGorelli MarcoGorelli changed the title Remove sd in favour of sigma Use sigma instead of sd, remove deprecationwarning Dec 25, 2020
@codecov
Copy link

codecov bot commented Dec 25, 2020

Codecov Report

Merging #4344 (b7ec8de) into master (e0ee447) will increase coverage by 0.08%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4344      +/-   ##
==========================================
+ Coverage   87.95%   88.04%   +0.08%     
==========================================
  Files          88       88              
  Lines       14501    14482      -19     
==========================================
- Hits        12754    12750       -4     
+ Misses       1747     1732      -15     
Impacted Files Coverage Δ
pymc3/distributions/continuous.py 94.37% <ø> (+1.29%) ⬆️
pymc3/distributions/mixture.py 88.96% <ø> (+0.26%) ⬆️
pymc3/distributions/timeseries.py 86.70% <ø> (+0.99%) ⬆️

@twiecki
Copy link
Member

twiecki commented Dec 25, 2020

What's up with our tests?

tau, sigma = get_tau_sigma(tau=tau, sigma=sigma)
self.sigma = self.sd = tt.as_tensor_variable(sigma)
Copy link
Member

Choose a reason for hiding this comment

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

I think we can leave self.sd too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, I can revert this, but wouldn't it be safer to have a single source of truth for the value of sigma?

Copy link
Member

Choose a reason for hiding this comment

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

I agree with your sentiment, but from user perspective, setting sd=x I would expect there to be a y.sd, and if we're keeping it around, which isn't the cleanest anyway, I don't see what we gain by changing this one thing in a subtle way.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

makes sense, thanks for explaining!

@twiecki twiecki merged commit 3cfee77 into pymc-devs:master Dec 26, 2020
@twiecki
Copy link
Member

twiecki commented Dec 26, 2020

Thanks @MarcoGorelli!

@MarcoGorelli MarcoGorelli deleted the remove-sd branch December 26, 2020 16:31
bsmith89 pushed a commit to bsmith89/pymc3 that referenced this pull request Dec 29, 2020
* remove sd deprecation warning

* sd -> sigma in pymc3/tests/test_models_linear.py::TestGLM

* update cls.sd in tests

* noop

* don't delete self.sd
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.

5 participants