Hello! If this is my elementary test: ``` ...
# ask-elementary-ai
r
Hello! If this is my elementary test:
Copy code
- elementary.column_anomalies:
              arguments:
                column_anomalies:
                  - average
                dimensions:
                  - country
                seasonality: day_of_week
                detection_delay:
                  period: day
                  count: 1
                anomaly_sensitivity: 2
What would the training_period and detection_period be?
k
A message from kapa.ai
Based on your test configuration, you have not explicitly set the
training_period
or
detection_period
parameters. In this case, Elementary will use the default values for these parameters. Defaults: - training_period: 14 days (by default) - detection_period: 2 days (by default) However, since you have set
seasonality: day_of_week
, Elementary will automatically increase the
training_period
to ensure there are enough data points for each day of the week. This means your actual training period will likely be longer than 14 days, depending on your data, to ensure there are enough Mondays, Tuesdays, etc., for the anomaly calculation. This behavior is documented and has been confirmed in community discussions as well [training_period documentation](https://docs.elementary-data.com/data-tests/anomaly-detection-configuration/training-period), [Slack discussion](https://slack.com/archives/C02CTC89LAX/p1730105471918989). Summary: - training_period: At least 14 days, but will be increased automatically to ensure enough data for each day of the week due to
seasonality: day_of_week
. - detection_period: 2 days (default), unless you override it. If you want to control these periods precisely, you should set them explicitly in your test configuration. References: - [training_period documentation](https://docs.elementary-data.com/data-tests/anomaly-detection-configuration/training-period) - [How anomaly detection works](https://docs.elementary-data.com/data-tests/how-anomaly-detection-works) - [Slack discussion on seasonality and training period](https://slack.com/archives/C02CTC89LAX/p1730105471918989)
r
@kapa.ai When it says "increased automatically to ensure enough data", how does it decide what is enough data?
k
A message from kapa.ai
New message text here
r
@kapa.ai And how would you change this test definition if you wanted to only have the severity set to warn?
k
A message from kapa.ai
To set the severity of your Elementary test to "warn", you should add a
config
block with
severity: warn
to your test definition. Here’s how your test would look:
Copy code
yaml - elementary.column_anomalies:     arguments:       column_anomalies:         - average       dimensions:         - country       seasonality: day_of_week       detection_delay:         period: day         count: 1       anomaly_sensitivity: 2     config:       severity: warn
This approach is supported and recommended in both the Elementary documentation and community discussions. Setting
severity: warn
ensures that anomalies will only trigger warnings and will not cause your dbt run to fail or block downstream models [Configure anomaly detection tests](https://docs.elementary-data.com/data-tests/add-elementary-tests#configure-your-elementary-anomaly-detection-tests) [Slack example](https://slack.com/archives/C02CTC89LAX/p1688028623624369).
r
@kapa.ai ok, now after running this kind of test, where would I go if I wanted to see which countries triggered an anomaly?
k
A message from kapa.ai
After running a column anomalies test with a dimension like
country
, you can see which countries triggered an anomaly by querying the results in the following places: 1. elementary_test_results table: This table stores the results of your tests, including which dimension values (e.g., countries) triggered anomalies. You can filter for your specific test and look for rows where the test failed or was flagged as anomalous. The relevant dimension (country) will be included in the results [Slack discussion](https://slack.com/archives/C02CTC89LAX/p1737377522035139). 2. test_result_rows table: For more detailed anomaly score data (including the dimension values that triggered anomalies), you can query the
test_result_rows
table in your Elementary schema. This table contains the metrics and anomaly scores for each dimension value, allowing you to identify which countries had anomalies [Slack discussion](https://slack.com/archives/C02CTC89LAX/p1704824907817899). 3. Elementary UI/Report: If you are using the Elementary UI, you can also view the test results and see which dimension values (countries) triggered anomalies directly in the report interface. Summary: Query either the
elementary_test_results
or
test_result_rows
table in your Elementary schema, filtering for your test and looking at the
country
dimension to see which countries triggered anomalies.