Check is working and returned WARNING, Message: Cannot check: ARRAY is not numeric
Hello Dataiku community,
I've created a custom metric which returns len(example_variable) and I am using this metric as the value I want to check, however I am getting the below warning.
Message: Cannot check: ARRAY is not numeric
I am not sure why I'm getting this message as the metric is an INT.
What am I doing wrong?
Best Answer
-
Turribeach Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023 Posts: 2,117 Neuron
Try with this metric probe, it should be added on the dataset you want it to run:
def process(dataset): df = dataset.get_dataframe() empty_columns = [] for col in df: if len(df[col].value_counts()) == 0: empty_columns.append(col) return {'metric_name' : len(empty_columns)}
Answers
-
Turribeach Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023 Posts: 2,117 Neuron
Please post the code of your Python probe.
-
# Define here a function that returns the metric. import dataiku def process(): example_dataset = dataiku.Dataset("example_dataset") df = example_dataset.get_dataframe() empty_columns = [] for col in df: if len(df[col].value_counts()) == 0: empty_columns.append(col) return len(empty_columns)
-
Unfortunately, did not work. I am still getting the same error on the check side.
-
LouisDHulst Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Neuron, Registered, Neuron 2023 Posts: 54 Neuron
I was able to get the check working with @Turribeach
's probe. I can recreate your error by returning the list instead of the len(list).Can you double check that you have the right metric selected in the check? Since the fix returns a dict it might have created a new metric.
-
Oh, yes you're right, it works now, thank you!
-
Turribeach Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023 Posts: 2,117 Neuron
Final tip: don’t forget to add your scenario step to calculate metrics and checks or alternatively you can set them to compute at build time.