Skip to content

Cross-validation, eight months ​

match ← All flat growth benchmarks

Two rolling cutoffs on the 256-day history, with rolling-window metrics.

Input ​

benchmark/inputs/v1/flat-mixed-components-large.json: 256 history rows and 64 forecast rows.

Output ​

Largest difference: 2.4e-7 (< 0.0001% of the input's range).

Each row is one forecast made during cross-validation, next to the value that actually happened.

DateActualEffect ProphetPython ProphetDifference
2020-08-1335.025335.000535.00051.6e-7
2020-08-1448.763748.652548.65251.8e-7
2020-08-1541.087641.066241.06622.4e-7
2020-08-1628.875628.925128.92512.4e-7
2020-08-1721.404621.358521.35851.8e-7
2020-08-1836.257036.199336.19931.6e-7
2020-08-1934.921434.996034.99607.3e-8
2020-08-2045.877145.953445.95344.3e-8
2020-08-2148.689448.656748.65679.5e-9
2020-08-2241.056841.067141.06719.2e-8
2020-08-2334.891335.000935.00094.9e-8
2020-08-2422.541522.559922.55991.2e-7
2020-08-2524.126924.052724.05274.7e-8
2020-08-2634.976634.993034.99302.7e-8

Timing ​

Median of all measured repetitions.

StepEffect ProphetPython ProphetEffect Prophet is
Convert input rows118 µs511 µsNot compared: different work
Plan cross-validation folds2.27 ms768 µsNot compared: different work
Cross-validate6.27 ms39.0 msNot compared: different work
Compute metrics85 µs5.48 msNot compared: different work
Score baselines2.71 ms1.40 msNot compared: different work
First cross-validation in a new process192 ms1.47 sNot compared: different work

Some steps aren't compared, because the two libraries' public calls produce different outputs. Their times show what each call costs, not which library is faster.

  • Convert input rows, Plan cross-validation folds, Cross-validate, Compute metrics, Score baselines, First cross-validation in a new process: Python Prophet's cross-validation returns different outputs, and baselines, search and holdout reports have no Python API, so the benchmark times equivalent application code. The two libraries also compute ranges and some metrics differently.

Settings ​

The case declaration both libraries ran.

json
{
  "kind": "evaluation",
  "comparison": {
    "kind": "different-public-work",
    "evidenceId": "rolling-origin-evaluation-v1"
  },
  "configuration": {
    "growth": "flat",
    "scaling": "minmax",
    "seasonalityMode": "additive",
    "holidaysMode": "additive",
    "changepoints": {
      "mode": "auto",
      "count": 25,
      "range": 0.8
    },
    "changepointPriorScale": 0.05,
    "seasonalities": [
      {
        "name": "weekly-custom",
        "periodDays": 7,
        "fourierOrder": 2,
        "priorScale": 10,
        "conditionName": "active",
        "mode": "multiplicative"
      }
    ],
    "events": [
      {
        "name": "campaign",
        "date": "2020-01-22",
        "lowerWindowDays": 0,
        "upperWindowDays": 0,
        "priorScale": 10
      }
    ],
    "regressors": [
      {
        "name": "promotion",
        "priorScale": 10,
        "standardization": "never"
      }
    ]
  },
  "effectOptimizer": {
    "algorithm": "lbfgs",
    "maxIterations": 10000,
    "fallback": "none",
    "lbfgs": {
      "historySize": 5,
      "initAlpha": 0.001,
      "tolObj": 1e-12,
      "tolRelObj": 10000,
      "tolGrad": 1e-8,
      "tolRelGrad": 10000000,
      "tolParam": 1e-8
    }
  },
  "pythonOptimizer": {
    "algorithm": "LBFGS",
    "maxIterations": 10000,
    "newtonFallback": false
  },
  "plan": {
    "horizonMs": 604800000,
    "cutoffs": [
      "2020-08-12T00:00:00.000Z",
      "2020-08-19T00:00:00.000Z"
    ]
  },
  "metricAggregation": "rolling"
}

Inspired by Prophet from Meta. Not affiliated with Meta.