MCPcopy
hub / github.com/facebook/prophet / predictive_samples

Method predictive_samples

python/prophet/forecaster.py:1815–1838  ·  view source on GitHub ↗

Sample from the posterior predictive distribution. Returns samples for the main estimate yhat, and for the trend component. 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

(self, df: pd.DataFrame, vectorized: bool = True)

Source from the content-addressed store, hash-verified

1813 return sample_trends - sample_trends.mean(axis=0)
1814
1815 def predictive_samples(self, df: pd.DataFrame, vectorized: bool = True):
1816 """Sample from the posterior predictive distribution. Returns samples
1817 for the main estimate yhat, and for the trend component. The shape of
1818 each output will be (nforecast x nsamples), where nforecast is the
1819 number of points being forecasted (the number of rows in the input
1820 dataframe) and nsamples is the number of posterior samples drawn.
1821 This is the argument `uncertainty_samples` in the Prophet constructor,
1822 which defaults to 1000.
1823
1824 Parameters
1825 ----------
1826 df: Dataframe with dates for predictions (column ds), and capacity
1827 (column cap) if logistic growth.
1828 vectorized: Whether to use a vectorized method to compute possible draws. Suggest using
1829 True (the default) for much faster runtimes in most cases,
1830 except when (growth = 'logistic' and mcmc_samples > 0).
1831
1832 Returns
1833 -------
1834 Dictionary with keys "trend" and "yhat" containing
1835 posterior predictive samples for that component.
1836 """
1837 df = self.setup_dataframe(df.copy())
1838 return self.sample_posterior_predictive(df, vectorized)
1839
1840 def percentile(self, a, *args, **kwargs):
1841 """

Callers

nothing calls this directly

Calls 2

setup_dataframeMethod · 0.95

Tested by

no test coverage detected