Scikit-learn: “The least populated class in y has only 1 member”

前端 未结 1 642
长情又很酷
长情又很酷 2021-01-27 03:32

I am trying to do a Random Forest Regression using Scikit-learn. The first step after loading the data using Pandas is to split the data into a test set and a training set. Howe

相关标签:
1条回答
  • 2021-01-27 03:50

    Error raised in this line :

    X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.22, random_state=123, stratify=y)
    

    Try to delete stratify=y

    0 讨论(0)
提交回复
热议问题