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

# Samples with mixed effects

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

512 raw simulated values per date for the same mixed model.

## 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-02 | 56.8946 | 56.8946 | 1.8e-10 |
| 2020-04-03 | 58.9619 | 58.9619 | 1.7e-10 |
| 2020-04-04 | 49.8863 | 49.8863 | 1.4e-10 |
| 2020-04-05 | 42.5866 | 42.5866 | 1.4e-10 |
| 2020-04-06 | 26.0176 | 26.0176 | 1.2e-10 |
| 2020-04-08 | 44.1660 | 44.1660 | 1.7e-10 |
| 2020-04-10 | 42.9853 | 42.9853 | 1.5e-10 |
| 2020-04-12 | 35.6534 | 35.6534 | 1.2e-10 |
| 2020-04-14 | 31.1089 | 31.1089 | 1.6e-10 |
| 2020-04-16 | 57.0518 | 57.0518 | 1.7e-10 |
| 2020-04-18 | 51.1965 | 51.1965 | 1.5e-10 |
| 2020-04-20 | 45.1353 | 45.1353 | 1.7e-10 |

## Timing

Median of all measured repetitions.

| Step | Effect Prophet | Python Prophet | Effect Prophet is |
| --- | ---: | ---: | --- |
| Convert input rows | 39 µs | 540 µs | 14× faster |
| Save model to JSON | 25 µs | 677 µs | 27× faster |
| Load model from JSON | 192 µs | 3.62 ms | 19× faster |
| Simulate uncertainty | 798 µs | 68.6 ms | Not compared: different work |
| First simulation in a new process | 181 ms | 1.54 s | Not compared: different work |
| Load and simulate in a new process | 168 ms | 1.53 s | Not 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.

* **Simulate uncertainty, First simulation in a new process, Load and simulate in a new process:** Python's `predictive_samples(vectorized=False)` and Effect Prophet's `predictUncertainty` are different public calls: Python's timing includes resetting NumPy's random generator and returns NumPy matrices, and the two don't draw the same random numbers.

## 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
  },
  "uncertainty": {
    "seed": 19,
    "samples": 512,
    "intervalWidth": 0.8,
    "output": "samples",
    "algorithm": "scalar-continuous-time",
    "evidence": "docs/validation/uncertainty.md#evidence-classes",
    "samplerMemoryLimitBytes": 67108864
  }
}
```
