Skip to content

Improve sampling coverage #4270

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 3 commits into from
Nov 29, 2020
Merged

Conversation

MarcoGorelli
Copy link
Contributor

@MarcoGorelli MarcoGorelli commented Nov 28, 2020

Added test cases for pm.sample(idata_kwargs=....) and for random_seed=-1.

While doing this, I also came across some outdated Python2 constructs (which I changed)

assert isinstance(result, az.InferenceData)
assert result.posterior.sizes["draw"] == 100
assert result.posterior.sizes["chain"] == 2
assert len(result._groups_warmup) == 0
pass
Copy link
Contributor Author

Choose a reason for hiding this comment

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

unnecessary pass statement

Copy link
Member

Choose a reason for hiding this comment

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

I like to put them there to mark the end of a test/function (just like an unnecessary return).

In my opinion they have a few advantages:

  • trailing comments are collapsed together with the code
  • because the pass in a test, or return in a function was put there on purpose, you don't wonder if somebody just stopped writing, or accidentally deleted some code

Not saying you must put it back in - just showing a maybe new perspective :)

Copy link
Member

Choose a reason for hiding this comment

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

To me that looks weird and confusing.

@MarcoGorelli MarcoGorelli marked this pull request as draft November 28, 2020 16:31
@MarcoGorelli MarcoGorelli marked this pull request as ready for review November 28, 2020 16:44
@codecov
Copy link

codecov bot commented Nov 28, 2020

Codecov Report

Merging #4270 (fa42e7e) into master (edbafaa) will increase coverage by 0.06%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4270      +/-   ##
==========================================
+ Coverage   87.44%   87.51%   +0.06%     
==========================================
  Files          88       88              
  Lines       14342    14333       -9     
==========================================
+ Hits        12542    12543       +1     
+ Misses       1800     1790      -10     
Impacted Files Coverage Δ
pymc3/sampling.py 86.21% <100.00%> (+0.70%) ⬆️
pymc3/parallel_sampling.py 86.79% <0.00%> (+0.94%) ⬆️

assert isinstance(result, az.InferenceData)
assert result.posterior.sizes["draw"] == 100
assert result.posterior.sizes["chain"] == 2
assert len(result._groups_warmup) == 0
pass
Copy link
Member

Choose a reason for hiding this comment

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

I like to put them there to mark the end of a test/function (just like an unnecessary return).

In my opinion they have a few advantages:

  • trailing comments are collapsed together with the code
  • because the pass in a test, or return in a function was put there on purpose, you don't wonder if somebody just stopped writing, or accidentally deleted some code

Not saying you must put it back in - just showing a maybe new perspective :)

@michaelosthege
Copy link
Member

Looks generally good! Just a few questions/details in the comments and then we'll be ✔️

@twiecki twiecki merged commit 4cccb46 into pymc-devs:master Nov 29, 2020
@twiecki
Copy link
Member

twiecki commented Nov 29, 2020

Thanks @MarcoGorelli!

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.

3 participants