Skip to content

Cross-validation with a forecast regressor ​

match ← All flat growth benchmarks

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

Input ​

benchmark/inputs/v4/flat-correlated-regressors.json: 730 history rows and 180 forecast rows.

Output ​

Largest difference: 0.012 (0.094% of the input's range).

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

DateActualEffect ProphetPython ProphetDifference
2021-12-0345.563946.011046.02200.011
2021-12-0443.846644.646544.65760.011
2021-12-0543.250743.167043.17830.011
2021-12-0643.887342.625442.63680.011
2021-12-0744.492743.379943.39150.012
2021-12-0845.258544.841744.85390.012
2021-12-0946.238345.866445.87880.012
2021-12-1745.539345.217245.20960.0076
2021-12-1843.946643.839743.83230.0074
2021-12-1942.848742.366942.35970.0071
2021-12-2043.565241.842841.83580.0070
2021-12-2144.697942.589142.58220.0069
2021-12-2245.259344.029144.02130.0078
2021-12-2345.821845.043545.03560.0079

Timing ​

Median of all measured repetitions.

StepEffect ProphetPython ProphetEffect Prophet is
Convert input rows250 µs750 µsNot compared: different work
Plan cross-validation folds2.61 ms1.01 msNot compared: different work
Cross-validate60.3 ms227 msNot compared: different work
Compute metrics98 µs5.25 msNot compared: different work
Score baselines7.10 ms2.00 msNot compared: different work
First cross-validation in a new process260 ms1.64 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": "absmax",
    "seasonalityMode": "additive",
    "holidaysMode": "additive",
    "changepoints": {
      "mode": "auto",
      "count": 25,
      "range": 0.8
    },
    "changepointPriorScale": 0.05,
    "seasonalities": [
      {
        "name": "yearly-custom",
        "periodDays": 365.25,
        "fourierOrder": 10,
        "priorScale": 10
      },
      {
        "name": "weekly-custom",
        "periodDays": 7,
        "fourierOrder": 2,
        "priorScale": 10
      }
    ],
    "events": [],
    "regressors": [
      {
        "name": "temperature",
        "priorScale": 10,
        "standardization": "auto",
        "predictor": true
      },
      {
        "name": "baseline",
        "priorScale": 10,
        "standardization": "never"
      }
    ]
  },
  "pythonOptimizer": {
    "algorithm": "Auto",
    "maxIterations": 10000,
    "newtonFallback": true,
    "sigFigs": 12
  },
  "plan": {
    "horizonMs": 604800000,
    "cutoffs": [
      "2021-12-02T00:00:00.000Z",
      "2021-12-16T00:00:00.000Z"
    ]
  },
  "metricAggregation": "horizons"
}

Inspired by Prophet from Meta. Not affiliated with Meta.