<@U088WCP3B4P> For the dashboard, there's a choice...
# ask-elementary-ai
a
@kapa.ai For the dashboard, there's a choice in how many days you want to put as history for the training data of the tests. Is there a recommender number of days to have good analysis on elementary tests ?
k
A message from kapa.ai
The recommended number of days for the training period in Elementary anomaly detection tests is 14 days by default. This default is chosen to provide a balance between having enough historical data for reliable anomaly detection and not making the model too insensitive to recent changes. - If you increase the training period (e.g., 30 days), the test will be less sensitive to outliers, reducing false positives but potentially missing subtle anomalies. - If you decrease the training period (e.g., less than 14 days), the test becomes more sensitive, which can lead to more false positives. It's generally not recommended to set the training period to less than 14 days, as this can cause false positives. However, you can adjust this value based on your data's characteristics and how sensitive you want the anomaly detection to be. For example, if your data is highly volatile, a longer training period may help smooth out noise. If you want to catch anomalies more quickly, a shorter period may be appropriate, but be aware of the increased risk of false alerts. Also, if you use seasonality (e.g.,
day_of_week
), Elementary may automatically increase the training period to ensure enough data points for each seasonality bucket (e.g., enough Mondays, Tuesdays, etc.) to make accurate calculations [training_period documentation](https://docs.elementary-data.com/data-tests/anomaly-detection-configuration/training-period). In summary: 14 days is the default and generally recommended minimum. Adjust upwards for less sensitivity and fewer false positives, or downwards for more sensitivity (with caution). Consider your data's update frequency and seasonality when making this decision.
a
@kapa.ai I'm asking this because i have some time windows that act as features for a ml model that have quite high variance so elementary tends to fail quite often on those, that's why i was thinking that maybe it needed more days in the history for training
k
A message from kapa.ai
You're on the right track—if your features have high variance and Elementary is flagging too many anomalies, increasing the training period (i.e., using more days of history) is a recommended approach. A larger training set gives the anomaly detection logic a better understanding of the natural variability in your data, which helps reduce false positives and makes the test less sensitive to outliers. As described in the documentation, "If you increase training_period your test training set will be larger. This means a larger sample size for calculating the expected range, which should make the test less sensitive to outliers. This means less chance of false positive anomalies, but also less sensitivity so anomalies have a higher threshold" ([training_period documentation](https://docs.elementary-data.com/data-tests/anomaly-detection-configuration/training-period)). So, for features with high variance, increasing the training period is a good practice. You may need to experiment with different values to find the right balance for your use case. If you use seasonality, keep in mind that Elementary may automatically extend the training period to ensure enough data for each seasonal bucket. In summary: Yes, increasing the number of days in the training period should help reduce false positives for high-variance features.