---
url: >-
  https://jer-k.github.io/effect-prophet/benchmarks/linear/linear-mixed-components.md
---

# Additive and multiplicative together

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

A multiplicative switchable weekly pattern with an additive event and regressor, on 96 daily rows.

## Input

[`benchmark/inputs/v1/linear-mixed-components.json`](https://github.com/jer-k/effect-prophet/blob/main/benchmark/inputs/v1/linear-mixed-components.json): 96 history rows and 24 forecast rows.

## Output

Largest difference: **1.8e-10** (< 0.0001% of the input's range).

Every forecast row from both libraries.

| Date | Effect Prophet | Python Prophet | Difference |
| --- | ---: | ---: | ---: |
| 2020-04-06 | 26.0176 | 26.0176 | 1.2e-10 |
| 2020-04-07 | 29.3874 | 29.3874 | 1.4e-10 |
| 2020-04-08 | 44.1660 | 44.1660 | 1.7e-10 |
| 2020-04-09 | 56.3191 | 56.3191 | 1.7e-10 |
| 2020-04-10 | 42.9853 | 42.9853 | 1.5e-10 |
| 2020-04-11 | 50.5414 | 50.5414 | 1.5e-10 |
| 2020-04-12 | 35.6534 | 35.6534 | 1.2e-10 |
| 2020-04-13 | 26.3580 | 26.3580 | 1.3e-10 |
| 2020-04-14 | 31.1089 | 31.1089 | 1.6e-10 |
| 2020-04-15 | 43.3841 | 43.3841 | 1.5e-10 |
| 2020-04-16 | 57.0518 | 57.0518 | 1.7e-10 |
| 2020-04-17 | 60.5134 | 60.5134 | 1.7e-10 |
| 2020-04-18 | 51.1965 | 51.1965 | 1.5e-10 |
| 2020-04-19 | 36.1147 | 36.1147 | 1.2e-10 |
| 2020-04-20 | 45.1353 | 45.1353 | 1.7e-10 |
| 2020-04-21 | 30.1549 | 30.1549 | 1.5e-10 |
| 2020-04-22 | 43.9599 | 43.9599 | 1.6e-10 |
| 2020-04-23 | 57.7845 | 57.7845 | 1.8e-10 |
| 2020-04-24 | 61.2891 | 61.2891 | 1.8e-10 |
| 2020-04-25 | 44.1815 | 44.1815 | 1.5e-10 |
| 2020-04-26 | 37.9433 | 37.9433 | 1.5e-10 |
| 2020-04-27 | 27.0388 | 27.0388 | 1.3e-10 |
| 2020-04-28 | 30.5386 | 30.5386 | 1.5e-10 |
| 2020-04-29 | 44.5183 | 44.5183 | 1.6e-10 |

## Timing

Median of all measured repetitions.

| Step | Effect Prophet | Python Prophet | Effect Prophet is |
| --- | ---: | ---: | --- |
| Convert input rows | 46 µs | 540 µs | 12× faster |
| Fit | 6.07 ms | 23.0 ms | 3.8× faster |
| Predict | 268 µs | 4.74 ms | 18× faster |
| Fit and predict | 4.92 ms | 29.5 ms | 6.0× faster |
| Convert, fit and predict | 4.73 ms | 28.8 ms | 6.1× faster |
| First forecast in a new process | 177 ms | 1.47 s | 8.3× faster |
| Save model to JSON | 34 µs | 685 µs | 20× faster |
| Load model from JSON | 129 µs | 3.67 ms | 28× faster |
| Load and predict in a new process | 164 ms | 1.44 s | 8.8× faster |

## Settings

The case declaration both libraries ran.

```json
{
  "kind": "map",
  "comparison": {
    "kind": "equivalent-objective",
    "evidenceId": "linear-output-first-v4"
  },
  "configuration": {
    "growth": "linear",
    "scaling": "absmax",
    "seasonalityMode": "multiplicative",
    "holidaysMode": "additive",
    "changepoints": {
      "mode": "explicit",
      "timestamps": [
        "2020-02-10T00:00:00.000Z"
      ]
    },
    "changepointPriorScale": 0.2,
    "seasonalities": [
      {
        "name": "weekly-custom",
        "periodDays": 7,
        "fourierOrder": 2,
        "priorScale": 10,
        "conditionName": "active"
      }
    ],
    "events": [
      {
        "name": "campaign",
        "date": "2020-01-22",
        "lowerWindowDays": 0,
        "upperWindowDays": 0,
        "priorScale": 10
      }
    ],
    "regressors": [
      {
        "name": "promotion",
        "priorScale": 10,
        "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
  }
}
```
