rnv86
rnv86

Reputation: 880

Error with scikit learn CV

When I try in Python the following

from sklearn.model_selection import KFold

but then when I try to define the KFold

kf=KFold(33,10, shuffle=True)

I get the following error:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-32-f6318606322e> in <module>()
----> 1 kf=KFold(33,10, shuffle=True)

TypeError: __init__() got multiple values for argument 'shuffle'

How can I solve this error?

Upvotes: 0

Views: 659

Answers (1)

raul
raul

Reputation: 781

Here is the syntax for defining kfold -

from sklearn.model_selection import KFold
kf = KFold(n_splits=3, shuffle=False, random_state=None)

where n_splits define the number of folds(splits) you want the dataset to be .So for a value of n_splits =3 implies that you will have 3 iterations dataset run on the modelwith split into train,test(test=1/k)

Upvotes: 1

Related Questions