Skip to content

v0.4.0

Choose a tag to compare

@jer-k jer-k released this 25 Oct 23:33
· 101 commits to main since this release
c6e109e

Shortcuts for everyday jobs: forecast in one call, get ranges with every forecast, flag unusual
values, and start a refit from an earlier model. Existing code works as before.

Added

  • forecast fits a history and predicts your future rows in one call. The result is exactly
    what fit and then predict return. The model isn't returned, so call fit and predict
    yourself when you want to reuse or save it.
  • predictWithIntervals returns each forecast with its value and trend ranges, so you no
    longer call predict and predictUncertainty and match up their rows yourself.
  • detectAnomalies checks new measurements against a model you already fitted and says
    whether each is below, within or above its range. The model isn't refitted, so it suits
    monitoring: train on last quarter, check this week. Ranges default to 99% wide.
  • anomalies fits a history and returns the timestamps whose values fall outside their own
    99% range, like Prophet.anomalies in prophet-ruby. The flagged values also shape the fit, so a
    large outlier can hide smaller ones; see Finding anomalies.
  • Warm starts, like Python's warm_start_params. warmStartParameters(model) reads a fitted
    model's parameters, and passing them as map.warmStart starts the next fit from there. As in
    Python, the changepoint and coefficient values are used only when their counts still match.
    crossValidate and searchModels use the warm start for every fold.
  • A warm start isn't always faster, and a logistic refit after many new rows can settle on a much
    worse fit, in Python too. Updating a model with new data
    shows how to check for that.
  • Tracing spans for each new operation, and attributes on the fit span saying whether a fit was
    warm-started.
  • defaultIntervalWidth (0.8) and defaultAnomalyIntervalWidth (0.99) are exported.

Verification against Python Prophet

  • New fixtures check warm starts against Python's warm_start_params, for linear, flat,
    logistic and multiplicative models and for refits whose changepoint or coefficient counts no
    longer match.
  • New benchmarks check anomalies against the same steps written with Python Prophet, on
    linear, flat and logistic histories with known outliers. Both libraries must flag every one.
  • New benchmarks check warm starts against Python's fit(df, init=warm_start_params(m)):
    refit a history from an earlier fit after a day, a week or a month of new rows, for linear,
    flat and logistic growth, and time the refit beside a fresh fit.

Full Changelog: v0.3.0...v0.4.0