# Baseline calculation algorithm

**URL:** <https://discuss.elastic.co/t/baseline-calculation-algorithm/100384>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-machine-learning\
**Created:** [September 13, 2017, 4:23pm UTC](https://discuss.elastic.co/t/baseline-calculation-algorithm/100384 "2017-09-13T16:23:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kbb](https://avatars.discourse-cdn.com/v4/letter/k/9e8a1a/32.png) [@Kbb](https://discuss.elastic.co/u/Kbb)\
**Post date:** [September 13, 2017, 4:23pm UTC](https://discuss.elastic.co/t/baseline-calculation-algorithm/100384/1 "2017-09-13T16:23:53Z")

</div>

Could you please explane me the baseline calculation algorithm.  
I have a few questions.

- Is that something like mean value plus and minus standard deviation multiplied by some coefficient (3, for example)?

- Which types of seasonality are used - daily (for each hour), weekly(for each day of the week)?

- If we have collected timeseries data over a long period of time (months, years), what time period is used for the baseline calculation?

- What is the frequency and at what point baselines are recalculated? (Weekly, daily, maybe recalculations start at the moments when new documents are written to indices?)

- Is it possible to customise the baseline calculation algorithm? For example, to change the coefficient?

And one question related to analysis functions.

- Is it possible to add and use custom functions to analyze data?

Thank you in advance.  
Dmitry.

---

<div class="post-metadata">

**Author:** ![richcollier](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/richcollier/32/115035_2.png) [@richcollier](https://discuss.elastic.co/u/richcollier)\
**Post date:** [September 14, 2017, 7:01pm UTC](https://discuss.elastic.co/t/baseline-calculation-algorithm/100384/2 "2017-09-14T19:01:53Z")

</div>

Hello Dmity,

Here are some answers to your questions:

> Is that something like mean value plus and minus standard deviation multiplied by some coefficient (3, for example)?

Yes, and no- a simple +/- 3 std dev. is a simplified version of what we do. We do not assume a Gaussian distribution (which std. deviation does) - but rather use ML techniques to find the best probability distribution model for the data

> Which types of seasonality are used - daily (for each hour), weekly(for each day of the week)?

Daily and weekly for sure. We also look for other periodic frequencies that don't fall on the typical daily/weekly/etc. boundaries

> If we have collected timeseries data over a long period of time (months, years), what time period is used for the baseline calculation?

All data is used as the learning is continuous

> What is the frequency and at what point baselines are recalculated? (Weekly, daily, maybe recalculations start at the moments when new documents are written to indices?)

Every `bucket_span`'s worth of data affects the modeling

> Is it possible to customise the baseline calculation algorithm? For example, to change the coefficient?

No, not at this time

> Is it possible to add and use custom functions to analyze data?

No, however you can customize the query filters/aggegations/etc. that is used by the Datafeed before feeding the data to ML. In that way, you have a certain level of customization

---

<div class="post-metadata">

**Author:** ![Kbb](https://avatars.discourse-cdn.com/v4/letter/k/9e8a1a/32.png) [@Kbb](https://discuss.elastic.co/u/Kbb)\
**Post date:** [September 15, 2017, 9:37am UTC](https://discuss.elastic.co/t/baseline-calculation-algorithm/100384/3 "2017-09-15T09:37:24Z")

</div>

Hello Rich,  
Thanks for the detailed answers. Now analytics in X-Pack has become much clearer.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 13, 2017, 9:37am UTC](https://discuss.elastic.co/t/baseline-calculation-algorithm/100384/4 "2017-10-13T09:37:33Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
