Skip to content

v0.7.0

Choose a tag to compare

@jer-k jer-k released this 05 Nov 16:29
· 20 commits to main since this release
6fca765

Full Bayesian fitting, like Python's mcmc_samples, for the main model and for regressors
forecast by their own models. Code that only fits MAP models works as before at runtime, but code
that reads optimizer fields from a FittedProphet must now narrow it first.

Added

  • Full Bayesian fitting. fit(rows, { mcmc: { samples, seed } }) samples the posterior with
    a port of Stan 2.37.0's adaptive NUTS sampler, like Python's mcmc_samples, for flat, linear
    and logistic growth. It works with regressors forecast by their own models, and in
    crossValidate, searchModels, evaluateHoldout, forecast and anomaly detection. chains
    and warmup default to Python's 4 and samples / 2.

    • Forecasts use the posterior means. predictWithIntervals runs ceil(samples / draws)
      futures per draw and adds each component's range over the draws, and
      getRegressorCoefficients adds each coefficient's 80% range.
    • Saved models keep every draw, and fitSummary.diagnostics reports divergences, tree-depth
      hits, R-hat, effective sample sizes and step sizes.
    • New models are "flat-mcmc", "linear-piecewise-mcmc" and "logistic-piecewise-mcmc". A new
      FittingError reason, "sampling-limit", bounds the chains, draws and kept values.

    See Full Bayesian fitting.

  • Sampled regressor models. A regressor's predictor options take mcmc, like
    mcmc_samples in Python's regressor_predictor, so the model that forecasts a regressor can
    sample its posterior too, with its own seed, whether or not the main model samples. Its draws
    widen the main model's ranges, and saved models keep them. See
    Forecasting a regressor.

  • A new effect-prophet.wasm.componentRanges span, and mcmc.* attributes on the engine's fit
    and simulation spans. See the tracing guide.

  • Docs for agents and tools. The docs site publishes a Markdown copy of every page,
    llms.txt, llms-full.txt and a sitemap.

  • Did the optimizer finish? Checking the fit
    shows how to tell when L-BFGS stopped well short of the optimum, which both libraries can do on
    some histories. The warm-start caveat in
    Saving and loading models now
    explains why logistic refits can break after many new rows.

Changed

  • FittedProphet now includes posterior models, whose fitSummary describes the sampler rather
    than an optimizer, and so does RegressorModel["model"], for sampled regressor models. Code
    that reads optimizer fields such as fitSummary.objective from any fitted model must first
    check isMcmcModel(model), or use the new FittedMapProphet type. isLogisticModel and
    FittedLogisticProphet cover logistic models fitted either way.
  • simulation on uncertainty, cross-validation and anomaly results is now SimulationIdentity,
    which adds posteriorSimulationIdentity for posterior models. Holdout reports accept it as
    simulation.algorithm, and their model can be a posterior summary.

Verification against Python Prophet

  • Full Bayesian fitting benchmarks on flat, linear and logistic growth, including a regressor
    forecast by its own model, optimized or sampled, against Python Prophet's mcmc_samples. The
    two samplers' chains can't match draw for draw, so forecasts must agree within 0.15 of the
    narrowest 80% range and every range bound within the variation expected from the posterior's
    draws. Both libraries must keep the same number of draws, and divergences and R-hat are
    reported. Linear and flat fits take about as long as Python's, and ranges from a posterior are
    9–83 times faster, but logistic fits take 3–4 times as long as Python's native CmdStan.

Full Changelog: v0.6.0...v0.7.0