Skip to content
Advertisement

TypeError: train_test_split() got an unexpected keyword argument ‘test_size’

I’m trying to find the best feature set using random forest approach I need to split the dataset into test and train. here is my code

JavaScript

parameters data,data_y are parsing correctly. But I’m getting the following error. I couldn’t figure out why this is.

enter image description here

Advertisement

Answer

You are using the same function name in your code same as the one from sklearn.preprocessing, changing your function name would do the job. Something like this,

JavaScript

Explaination :- Although there is method overloading in python (ie. same named function selected on the basis on the type of arguments) here in your case turns out both the functions need the same type of arguments, so different naming is the only possible solution IMO.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement