facebook / facebook/prophet

shape of m.predictive_samples

Open
#1,719 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
20.4k
Forks
4.6k
Avg merge
19h 52m
Merged PRs (30d)
1

Description

The doc string for `predictive_samples` states: `The shape of each output will be (nforecast x nsamples), where nforecast is the number of points being forecasted (the number of rows in the input dataframe) and nsamples is the number of posterior samples drawn. This is the argument uncertainty_samples in the Prophet constructor, which defaults to 1000.`
https://github.com/facebook/prophet/blob/e41ed25646f44f713c110c30c07c678e4a07728e/python/fbprophet/forecaster.py#L1402
This is correct if `mcmc_samples=0`. However, if `mcmc_samples` is anything else, then the `nsamples` element of `predictive_samples` is not equal to `uncertainty_samples`. Here are some examples:

These ones match the doc string, that `nsamples` will equal `uncertainty_samples`:
`Prophet(uncertainty_samples=10, mcmc_samples=0)` --> `nsamples` = 10
`Prophet(uncertainty_samples=100, mcmc_samples=0)` --> `nsamples` = 100

But these ones don't match:
`Prophet(uncertainty_samples=10, mcmc_samples=2)` --> `nsamples` = 12
`Prophet(uncertainty_samples=10, mcmc_samples=3)` --> `nsamples` = 16
`Prophet(uncertainty_samples=10, mcmc_samples=4)` --> `nsamples` = 16
`Prophet(uncertainty_samples=10, mcmc_samples=20)` --> `nsamples` = 40

I don't see the pattern. How is `nsamples` calculated?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.