# Exclude data from certain interval from Machine Learning

**URL:** <https://discuss.elastic.co/t/exclude-data-from-certain-interval-from-machine-learning/249586>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-machine-learning\
**Created:** [September 22, 2020, 9:53pm UTC](https://discuss.elastic.co/t/exclude-data-from-certain-interval-from-machine-learning/249586 "2020-09-22T21:53:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![heric](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/heric/32/70748_2.png) [@heric](https://discuss.elastic.co/u/heric)\
**Post date:** [September 22, 2020, 9:53pm UTC](https://discuss.elastic.co/t/exclude-data-from-certain-interval-from-machine-learning/249586/1 "2020-09-22T21:53:54Z")

</div>

Hi All,

I have collected data to be used for machine learning for more than 2 weeks and accidentally i ruined my data collection for 1 interval, it is getting huge jump in value for this interval.

now machine learning anomaly detection is being affected by this highly abnormal value and if i run forecasting it will consider this faulty data as well

Is there any way that i can exclude this particular interval from the machine learning ?  
i tried to create a calendar mentioning this interval , but it doesn't have any effect , maybe because the interval was in the past ?

Below are the screenshot from the single metric viewer.

data crossing the faulty interval

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/b/c/bc2772c880a41ab8611cba172102024916efe961.png)

data from beginning until before the faulty interval

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/0/c/0cdadcf241fa2db63264133d58dbd0fa17923c2d.png)

Thanks,  
Heri

---

<div class="post-metadata">

**Author:** ![sophie\_chang](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sophie_chang/32/18008_2.png) [@sophie\_chang](https://discuss.elastic.co/u/sophie_chang)\
**Post date:** [September 23, 2020, 9:11am UTC](https://discuss.elastic.co/t/exclude-data-from-certain-interval-from-machine-learning/249586/2 "2020-09-23T09:11:40Z")

</div>

Anomaly detection is online learning, so we constantly update the model to reflect the data we have seen.

We store snapshots of this model along the way and it is possible to restore to a previous model snapshot. From 7.9, we have a UI for model snapshot management which will create a calendar event to skip the faulty period. Prior to that we have APIs that support restoring model state.

> **[Model snapshots | Machine Learning in the Elastic Stack \[7.9\] | Elastic](https://www.elastic.co/guide/en/machine-learning/current/ml-model-snapshots.html)**

  

> **[Machine learning anomaly detection APIs | Elasticsearch Reference \[7.9\] |...](https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-apis.html#ml-api-snapshot-endpoint)**

Alternatively you can clone the job, and run it again over the same data. Please remember to set a calendar event before hand.

---

<div class="post-metadata">

**Author:** ![heric](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/heric/32/70748_2.png) [@heric](https://discuss.elastic.co/u/heric)\
**Post date:** [September 23, 2020, 10:43am UTC](https://discuss.elastic.co/t/exclude-data-from-certain-interval-from-machine-learning/249586/3 "2020-09-23T10:43:48Z")

</div>

Thank you @sophie_chang .

---

<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 21, 2020, 10:43am UTC](https://discuss.elastic.co/t/exclude-data-from-certain-interval-from-machine-learning/249586/4 "2020-10-21T10:43:48Z")

</div>

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