Generate multiple Tests or Metrics
Sometimes you need to generate multiple column-level Tests or Metrics.
To simplify it, you can:
Pass a list of parameters or columns to a chosen Test or Metric
Use test/metric generator helper functions
List comprehension
You can pass a list of parameters/conditions or columns. It works the same for Tests and Metrics.
Example 1. Pass the list of quantile values to run multiple Tests for the same column.
Example 2. Apply the same Test with a defined custom condition for all columns in the list:
Column test generator
You can also use the generate_column_tests
function to create multiple Tests.
Example 1. Generate the same Test for all the columns in the dataset. It will use defaults if you do not specify the test condition.
You can also pass a custom Test condition:
Example 2. You can generate Tests for different subsets of columns. Here is how you generate tests only for numerical columns:
Here is how you generate tests only for categorical columns:
You can also generate Tests with a certain condition for a defined column list:
Column parameter
You can use the parameter columns
to define a list of columns to which you apply the tests. If it is a list, just use it as a list of the columns. If columns
is a string, it can take the following values:
"all"
- apply tests/metrics for all columns, including target/prediction columns."num"
- for numerical features, as provided by column mapping or defined automatically"cat"
- for categorical features, as provided by column mapping or defined automatically"features"
- for all features, excluding the target/prediction columns."none"
- the same as "all."
Column metric generator
It works the same way for metrics. In this case, you should use generate_column_metrics
function.
To generate multiple metrics for all the columns in the list with a custom parameter.
Last updated