Azure databricks Issue

Rohit Kulkarni 676 Reputation points

Hello Team,

I am trying to run the train_split data and i am getting error :


TypeError: Singleton array 77 cannot be considered a valid collection.

Please advise



Azure Databricks
Azure Databricks
An Apache Spark-based analytics platform optimized for Azure.
1,913 questions
{count} votes

1 answer

Sort by: Most helpful
  1. BhargavaGunnam-MSFT 25,971 Reputation points Microsoft Employee

    Hello Rohit Kulkarni,

    Welcome to the MS Q&A platform.

    As per the error message, it seems like you are passing a singleton array (an array with only one element) as an argument to the classification_report function. This is causing the function to raise a TypeError.

    Please check the shape of your ytest and ytest_predict arrays to ensure that they have the same number of elements

    import numpy as np



    If the shapes are the same then you can try reshaping the singleton array to be a one dimensional array using the np.ravel(), , which should be a valid collection for the classification_report function.


    If you are still facing the error, please provide more context or code snippets to understand the issue better.

    0 comments No comments