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

Require step methods to emit sampler stats #6270

Closed
michaelosthege opened this issue Nov 5, 2022 · 0 comments · Fixed by #6313
Closed

Require step methods to emit sampler stats #6270

michaelosthege opened this issue Nov 5, 2022 · 0 comments · Fixed by #6313
Assignees
Labels
maintenance major Include in major changes release notes section
Milestone

Comments

@michaelosthege
Copy link
Member

michaelosthege commented Nov 5, 2022

As a follow-up to #6205 we should require step methods (astep in particular) to always return stats.

Doing this will allow us to simplify code in places like these:

pymc/pymc/sampling.py

Lines 976 to 983 in 9c313cb

if step.generates_stats:
point, stats = step.step(point)
strace.record(point, stats)
log_warning_stats(stats)
diverging = i > tune and stats and stats[0].get("diverging")
else:
point = step.step(point)
strace.record(point)

def _compute_point(self):
if self._step_method.generates_stats:
point, stats = self._step_method.step(self._point)
else:
point = self._step_method.step(self._point)
stats = None
return point, stats

@michaelosthege michaelosthege added maintenance major Include in major changes release notes section labels Nov 5, 2022
@michaelosthege michaelosthege added this to the v4.4.0 milestone Nov 5, 2022
@michaelosthege michaelosthege self-assigned this Nov 18, 2022
michaelosthege added a commit to michaelosthege/pymc that referenced this issue Nov 18, 2022
The reason for this change is the resulting simplification of code,
including simpler branching and less type ambiguity.

Closes pymc-devs#6270
michaelosthege added a commit to michaelosthege/pymc that referenced this issue Nov 18, 2022
The reason for this change is the resulting simplification of code,
including simpler branching and less type ambiguity.

Closes pymc-devs#6270
michaelosthege added a commit to michaelosthege/pymc that referenced this issue Nov 18, 2022
The reason for this change is the resulting simplification of code,
including simpler branching and less type ambiguity.

Closes pymc-devs#6270
michaelosthege added a commit to michaelosthege/pymc that referenced this issue Nov 19, 2022
The reason for this change is the resulting simplification of code,
including simpler branching and less type ambiguity.
At the same time it allowed for fixing of a lot of type hints
and method signatures on step methods.

Closes pymc-devs#6270
michaelosthege added a commit that referenced this issue Nov 19, 2022
The reason for this change is the resulting simplification of code,
including simpler branching and less type ambiguity.
At the same time it allowed for fixing of a lot of type hints
and method signatures on step methods.

Closes #6270
wrongu pushed a commit to wrongu/pymc that referenced this issue Dec 1, 2022
The reason for this change is the resulting simplification of code,
including simpler branching and less type ambiguity.
At the same time it allowed for fixing of a lot of type hints
and method signatures on step methods.

Closes pymc-devs#6270
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance major Include in major changes release notes section
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant