Skip to content

Commit

Permalink
add n_draws and t_sampling report to smc (#3931)
Browse files Browse the repository at this point in the history
* add n_draws and t_sampling report to smc

* add _n_tune

* update release notes

* resolve conflicts
  • Loading branch information
aloctavodia authored May 25, 2020
1 parent 1522492 commit 30d28f4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
- `pm.Data` container can now be used for index variables, i.e with integer data and not only floats (issue [#3813](https://github.com/pymc-devs/pymc3/issues/3813), fixed by [#3925](https://github.com/pymc-devs/pymc3/pull/3925)).
- `pm.Data` container can now be used as input for other random variables (issue [#3842](https://github.com/pymc-devs/pymc3/issues/3842), fixed by [#3925](https://github.com/pymc-devs/pymc3/pull/3925)).
- Plots and Stats API sections now link to ArviZ documentation [#3927](https://github.com/pymc-devs/pymc3/pull/3927)
- Add `SamplerReport` with properties `n_draws`, `t_sampling` and `n_tune` to SMC. `n_tune` is always 0 [#3931](https://github.com/pymc-devs/pymc3/issues/3931).

### Maintenance
- Tuning results no longer leak into sequentially sampled `Metropolis` chains (see #3733 and #3796).
Expand Down
8 changes: 6 additions & 2 deletions pymc3/smc/sample_smc.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from .smc import SMC
import time
import logging
from .smc import SMC


def sample_smc(
Expand Down Expand Up @@ -144,6 +145,7 @@ def sample_smc(
random_seed=random_seed,
)

t1 = time.time()
_log = logging.getLogger("pymc3")
_log.info("Sample initial stage: ...")
stage = 0
Expand All @@ -170,5 +172,7 @@ def sample_smc(
smc.pool.join()

trace = smc.posterior_to_trace()

trace.report._n_draws = smc.draws
trace.report._n_tune = 0
trace.report._t_sampling = time.time() - t1
return trace

0 comments on commit 30d28f4

Please sign in to comment.