I am trying yo split the data using train_test_split(), but I got this error:

ValueError: Found input variables with inconsistent numbers of samples: [283, 943]

However, I have printed out the lengths of the two lists that I have input, and they are the same. I am confused why I have got this error. Could anyone help me with this? Thanks in advance.

printing result and code raising the error the error messages

  • $\begingroup$ Solved it. The stratify parameter is incorrect, it should be y_test_dev. $\endgroup$
    – user148336
    Mar 26, 2023 at 16:28


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.