Reputation: 153
I am trying to implement svm for sentiment analysis, i trying to implement this gitlink https://github.com/jatinwarade/Sentiment-analysis-using-SVM/blob/master/SVM.ipynb.
from sklearn.model_selection import ShuffleSplit
from sklearn.model_selection import StratifiedKFold
i refered this as it says to change cross origin to model_selection since it is depricated Error: __init__() got an unexpected keyword argument 'n_splits' so I replaced with this
grid_svm = GridSearchCV(
pipeline_svm, #object used to fit the data
param_grid=param_svm,
refit=True, # fit using all data, on the best detected classifier
n_jobs=-1, # number of cores to use for parallelization; -1 for "all cores" i.e. to run on all CPUs
scoring='accuracy',#optimizing parameter
cv=StratifiedKFold(liked_train,n_folds=5),
)
This Returns Error:
TypeError Traceback (most recent call last)
<ipython-input-49-61dd1e818fa4> in <module>
5 n_jobs=-1, # number of cores to use for parallelization; -1 for "all cores" i.e. to run on all CPUs
6 scoring='accuracy',#optimizing parameter
----> 7 cv=StratifiedKFold(liked_train,n_folds=5),
8 )
TypeError: __init__() got an unexpected keyword argument 'n_folds'
Please Help me solve this error
Upvotes: 2
Views: 14187
Reputation: 18221
As you can see in the documentation for model_selected.StrafiedKFold
, there is no keyword argument called n_folds
and you should indeed use n_splits
.
Note, however, that the data should not be passed as an argument to the validator and by doing so, you're effectively passing liked_train
as the argument for n_splits
, which won't work. Rather, you should pass the data only to the fit
of your grid_svm
after initialization.
Upvotes: 3