You are mixing up two different modules.
Before 0.18, cross_validation was used for ShuffleSplit. In that, n_splits
was not present. n
was used to define the number of splits
But since you have updated to 0.18 now, cross_validation
and grid_search
has been deprecated in favor of model_selection.
This is mentioned in docs here, and these modules will be removed from version 0.20
So instead of this:
from sklearn.cross_validation import ShuffleSplit
from sklearn.cross_validation import train_test_split
Do this:
from sklearn.model_selection import ShuffleSplit
fro
m sklearn.model_selection import train_test_split
Then you can use n_splits
.
cv = ShuffleSplit(n_splits = 10, test_size = 0.2, random_state = 0)
1
solved Error: __init__() got an unexpected keyword argument ‘n_splits’