Skip to content

Add a method to add the quantiles in a timseseries graph #124

@lordofthejars

Description

@lordofthejars

As we talked about in DevNexus, I'd love to plot some time series where I set the mean and the quantiles. What I've got is an array of floats for each part, here I pasted you a real example.

==== target =====
[112.0, 118.0, 132.0, 129.0, 121.0, 135.0, 148.0, 148.0, 136.0, 119.0, 104.0, 118.0, 115.0, 126.0, 141.0, 135.0, 125.0, 149.0, 170.0, 170.0, 158.0, 133.0, 114.0, 140.0, 145.0, 150.0, 178.0, 163.0, 172.0, 178.0, 199.0, 199.0, 184.0, 162.0, 146.0, 166.0, 171.0, 180.0, 193.0, 181.0, 183.0, 218.0, 230.0, 242.0, 209.0, 191.0, 172.0, 194.0, 196.0, 196.0, 236.0, 235.0, 229.0, 243.0, 264.0, 272.0, 237.0, 211.0, 180.0, 201.0, 204.0, 188.0, 235.0, 227.0, 234.0, 264.0, 302.0, 293.0, 259.0, 229.0, 203.0, 229.0, 242.0, 233.0, 267.0, 269.0, 270.0, 315.0, 364.0, 347.0, 312.0, 274.0, 237.0, 278.0, 284.0, 277.0, 317.0, 313.0, 318.0, 374.0, 413.0, 405.0, 355.0, 306.0, 271.0, 306.0, 315.0, 301.0, 356.0, 348.0, 355.0, 422.0, 465.0, 467.0, 404.0, 347.0, 305.0, 336.0, 340.0, 318.0, 362.0, 348.0, 363.0, 435.0, 491.0, 505.0, 404.0, 359.0, 310.0, 337.0, 360.0, 342.0, 406.0, 396.0, 420.0, 472.0, 548.0, 559.0, 463.0, 407.0, 362.0, 405.0, 417.0, 391.0, 419.0, 461.0, 472.0, 535.0, 622.0, 606.0, 508.0, 461.0, 390.0, 432.0]
==================

==== prediction =====
[442.40707, 442.26746, 473.85284, 503.2582, 544.3242, 631.8106, 703.4895, 682.01056, 584.2869, 496.65305, 458.26706, 486.83524]
================================

==== Quantile 50% =====
[441.90524, 438.94196, 475.58868, 504.77777, 546.2015, 631.03503, 703.1645, 684.6702, 585.4043, 497.68643, 456.81332, 487.01727]
================================

==== Quantile 90% =====
[470.60236, 472.7702, 506.5765, 537.26117, 573.006, 667.6558, 739.82074, 709.30133, 611.8065, 520.3827, 486.74255, 515.27356]
================================

The target is the real values (so it is the past) and should be plotted from the initial of the graph until one point after that point, when the prediction starts. The prediction is the array of the mean prediction, which is the main line, and then two quantiles.

Python does this, and the output graph looks like this:

https://d2kv9n23y3w0pn.cloudfront.net/static/README/forecasts.png

It's not necessary to be the same. Also notice that in that graph there is 3 predictions, in my case with only one prediction is enough

:)

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions