Check is working and returned WARNING, Message: Cannot check: ARRAY is not numeric

Options
KKhatib
KKhatib Registered Posts: 6

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
    Turribeach Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023 Posts: 1,714 Neuron
    Answer ✓
    Options

    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
    Turribeach Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023 Posts: 1,714 Neuron
    Options

    Please post the code of your Python probe.

  • KKhatib
    KKhatib Registered Posts: 6
    Options

    # Define here a function that returns the metric.import dataikudef 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)

  • KKhatib
    KKhatib Registered Posts: 6
    Options

    Unfortunately, did not work. I am still getting the same error on the check side.

  • LouisDHulst
    LouisDHulst Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Neuron, Registered, Neuron 2023 Posts: 44 Neuron
    Options

    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.

  • KKhatib
    KKhatib Registered Posts: 6
    Options

    Oh, yes you're right, it works now, thank you!

  • Turribeach
    Turribeach Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023 Posts: 1,714 Neuron
    Options

    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.

Setup Info
    Tags
      Help me…