Skip to content

Cross-validation with a forecast regressor ​

match ← All linear growth benchmarks

Two cutoffs and a 7-day horizon, fitting the regressor model again in each fold. Python's cross_validation refits it on standardized values, so Python is fitted at each cutoff instead.

Input ​

benchmark/inputs/v1/map-regressors-medium.json: 256 history rows and 64 forecast rows.

Output ​

Largest difference: 0.0024 (0.0025% 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-2397.534197.635297.63680.0016
2020-08-2498.540698.565898.56790.0020
2020-08-2597.363997.323497.32540.0021
2020-08-2697.803897.882897.88490.0020
2020-08-2798.314498.435398.43730.0020
2020-08-2899.331199.338799.34110.0024
2020-08-2999.852499.876499.87880.0024
2020-09-03102.6061102.8260102.82607.3e-5
2020-09-04101.7963101.9156101.91530.00022
2020-09-05102.7016102.7640102.76380.00022
2020-09-06103.0832103.2447103.24450.00017
2020-09-07103.5750103.7194103.71930.00012
2020-09-08104.1993104.1885104.18847.6e-5
2020-09-09106.8323106.8125106.81240.00010

Timing ​

Median of all measured repetitions.

StepEffect ProphetPython ProphetEffect Prophet is
Convert input rows108 µs544 µsNot compared: different work
Plan cross-validation folds2.25 ms796 µsNot compared: different work
Cross-validate51.6 ms185 msNot compared: different work
Compute metrics58 µs5.50 msNot compared: different work
Score baselines2.90 ms1.42 msNot compared: different work
First cross-validation in a new process245 ms1.62 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": "linear",
    "scaling": "absmax",
    "seasonalityMode": "additive",
    "holidaysMode": "additive",
    "changepoints": {
      "mode": "auto",
      "count": 25,
      "range": 0.8
    },
    "changepointPriorScale": 0.05,
    "seasonalities": [],
    "events": [],
    "regressors": [
      {
        "name": "binary-auto",
        "priorScale": 10,
        "standardization": "auto"
      },
      {
        "name": "numeric-auto",
        "priorScale": 10,
        "standardization": "auto",
        "predictor": true
      },
      {
        "name": "numeric-always",
        "priorScale": 7,
        "standardization": "always"
      },
      {
        "name": "numeric-never",
        "priorScale": 5,
        "standardization": "never"
      }
    ]
  },
  "effectOptimizer": {
    "algorithm": "auto",
    "maxIterations": 10000,
    "fallback": "newton",
    "lbfgs": {
      "historySize": 5,
      "initAlpha": 0.001,
      "tolObj": 1e-12,
      "tolRelObj": 10000,
      "tolGrad": 1e-8,
      "tolRelGrad": 10000000,
      "tolParam": 1e-8
    }
  },
  "pythonOptimizer": {
    "algorithm": "Auto",
    "maxIterations": 10000,
    "newtonFallback": true,
    "sigFigs": 12
  },
  "plan": {
    "horizonMs": 604800000,
    "cutoffs": [
      "2020-08-22T00:00:00.000Z",
      "2020-09-02T00:00:00.000Z"
    ]
  },
  "metricAggregation": "horizons"
}

Inspired by Prophet from Meta. Not affiliated with Meta.