---
url: >-
  https://jer-k.github.io/effect-prophet/benchmarks/linear/map-conditional-seasonalities-medium.md
---

# Two switchable weekly patterns

&#x20; [← All linear growth benchmarks](/benchmarks/linear)

256 daily rows. One weekly pattern applies on dense days, another on sparse days.

## Input

[`benchmark/inputs/v1/map-conditional-seasonalities-medium.json`](https://github.com/jer-k/effect-prophet/blob/main/benchmark/inputs/v1/map-conditional-seasonalities-medium.json): 256 history rows and 64 forecast rows.

## Output

Largest difference: **0.0027** (0.0028% of the input's range).

Every forecast row from both libraries.

| Date | Effect Prophet | Python Prophet | Difference |
| --- | ---: | ---: | ---: |
| 2020-09-13 | 108.2021 | 108.2012 | 0.00090 |
| 2020-09-14 | 107.1673 | 107.1664 | 0.00091 |
| 2020-09-15 | 108.2711 | 108.2701 | 0.0010 |
| 2020-09-16 | 110.0093 | 110.0084 | 0.00094 |
| 2020-09-17 | 111.0944 | 111.0934 | 0.0010 |
| 2020-09-18 | 111.5652 | 111.5642 | 0.00094 |
| 2020-09-19 | 111.9707 | 111.9695 | 0.0011 |
| 2020-09-20 | 111.3706 | 111.3695 | 0.0011 |
| 2020-09-21 | 112.2118 | 112.2106 | 0.0011 |
| 2020-09-22 | 111.7796 | 111.7783 | 0.0012 |
| 2020-09-23 | 113.1091 | 113.1072 | 0.0019 |
| 2020-09-24 | 114.6028 | 114.6016 | 0.0012 |
| 2020-09-25 | 115.0736 | 115.0725 | 0.0011 |
| 2020-09-26 | 115.4791 | 115.4777 | 0.0013 |
| 2020-09-27 | 114.8790 | 114.8777 | 0.0013 |
| 2020-09-28 | 114.1842 | 114.1829 | 0.0013 |
| 2020-09-29 | 116.2214 | 116.2200 | 0.0014 |
| 2020-09-30 | 117.0262 | 117.0248 | 0.0013 |
| 2020-10-01 | 118.1113 | 118.1098 | 0.0014 |
| 2020-10-02 | 118.5820 | 118.5807 | 0.0013 |
| 2020-10-03 | 119.9595 | 119.9585 | 0.0010 |
| 2020-10-04 | 118.3874 | 118.3859 | 0.0015 |
| 2020-10-05 | 117.6926 | 117.6911 | 0.0015 |
| 2020-10-06 | 118.7964 | 118.7948 | 0.0016 |
| 2020-10-07 | 120.2310 | 120.2294 | 0.0016 |
| 2020-10-08 | 121.6197 | 121.6181 | 0.0016 |
| 2020-10-09 | 122.0905 | 122.0889 | 0.0015 |
| 2020-10-10 | 122.4959 | 122.4942 | 0.0017 |
| 2020-10-11 | 121.8959 | 121.8942 | 0.0017 |
| 2020-10-12 | 121.8381 | 121.8367 | 0.0014 |
| 2020-10-13 | 122.3049 | 122.3030 | 0.0018 |
| 2020-10-14 | 124.0430 | 124.0413 | 0.0017 |
| 2020-10-15 | 124.2407 | 124.2389 | 0.0018 |
| 2020-10-16 | 125.5989 | 125.5972 | 0.0017 |
| 2020-10-17 | 126.0044 | 126.0024 | 0.0019 |
| 2020-10-18 | 125.4043 | 125.4024 | 0.0019 |
| 2020-10-19 | 124.7095 | 124.7076 | 0.0019 |
| 2020-10-20 | 125.8133 | 125.8113 | 0.0020 |
| 2020-10-21 | 127.5515 | 127.5495 | 0.0019 |
| 2020-10-22 | 128.6366 | 128.6345 | 0.0020 |
| 2020-10-23 | 128.2503 | 128.2483 | 0.0020 |
| 2020-10-24 | 129.5128 | 129.5107 | 0.0021 |
| 2020-10-25 | 128.9127 | 128.9106 | 0.0021 |
| 2020-10-26 | 128.8549 | 128.8531 | 0.0018 |
| 2020-10-27 | 129.3217 | 129.3195 | 0.0022 |
| 2020-10-28 | 131.0599 | 131.0578 | 0.0021 |
| 2020-10-29 | 132.1450 | 132.1428 | 0.0022 |
| 2020-10-30 | 132.6158 | 132.6136 | 0.0021 |
| 2020-10-31 | 133.2319 | 133.2302 | 0.0017 |
| 2020-11-01 | 132.4212 | 132.4189 | 0.0023 |
| 2020-11-02 | 131.7263 | 131.7240 | 0.0023 |
| 2020-11-03 | 132.8301 | 132.8277 | 0.0024 |
| 2020-11-04 | 134.5683 | 134.5660 | 0.0023 |
| 2020-11-05 | 135.6534 | 135.6510 | 0.0024 |
| 2020-11-06 | 136.1242 | 136.1219 | 0.0023 |
| 2020-11-07 | 136.5297 | 136.5271 | 0.0025 |
| 2020-11-08 | 136.2696 | 136.2671 | 0.0025 |
| 2020-11-09 | 135.2347 | 135.2323 | 0.0025 |
| 2020-11-10 | 136.3386 | 136.3360 | 0.0026 |
| 2020-11-11 | 138.0768 | 138.0742 | 0.0025 |
| 2020-11-12 | 139.1619 | 139.1592 | 0.0026 |
| 2020-11-13 | 139.6326 | 139.6301 | 0.0025 |
| 2020-11-14 | 140.0381 | 140.0354 | 0.0027 |
| 2020-11-15 | 139.4380 | 139.4353 | 0.0027 |

## Internal fit differences

The forecasts match, so this case passes. Both libraries search for the best-fitting parameters and stop when they are close enough. On this input they stopped at slightly different points, so these internal numbers differ by more than the threshold where we take a closer look.

| Check | Effect Prophet | Python Prophet | Threshold |
| --- | ---: | ---: | ---: |
| Stationarity residual (lower is closer to the best fit) | 20.9828 | 6.1113 | 0.01 |

## Timing

Median of all measured repetitions.

| Step | Effect Prophet | Python Prophet | Effect Prophet is |
| --- | ---: | ---: | --- |
| Convert input rows | 95 µs | 704 µs | 7.4× faster |
| Fit | 2.68 ms | 14.0 ms | 5.2× faster |
| Predict | 395 µs | 4.03 ms | 10× faster |
| Fit and predict | 2.77 ms | 16.8 ms | 6.1× faster |
| Convert, fit and predict | 2.56 ms | 17.2 ms | 6.7× faster |
| First forecast in a new process | 175 ms | 1.48 s | 8.5× faster |
| Save model to JSON | 22 µs | 671 µs | 31× faster |
| Load model from JSON | 108 µs | 2.84 ms | 26× faster |
| Load and predict in a new process | 168 ms | 1.47 s | 8.7× faster |

## Settings

The case declaration both libraries ran.

```json
{
  "kind": "linear-map",
  "comparison": {
    "kind": "equivalent-objective",
    "evidenceId": "linear-output-first-v4"
  },
  "configuration": {
    "effectMap": "explicit",
    "changepoints": {
      "mode": "explicit",
      "timestamps": [
        "2020-03-21T00:00:00.000Z",
        "2020-06-29T00:00:00.000Z"
      ]
    },
    "changepointPriorScale": 0.2,
    "seasonalities": [
      {
        "name": "weekly-dense",
        "periodDays": 7,
        "fourierOrder": 3,
        "priorScale": 10,
        "conditionName": "dense"
      },
      {
        "name": "weekly-sparse",
        "periodDays": 7,
        "fourierOrder": 3,
        "priorScale": 8,
        "conditionName": "sparse"
      }
    ],
    "events": [],
    "regressors": []
  },
  "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
  }
}
```
