0

I'm trying to split the data set using the stratified k-fold and multinomial logistic regression but I got the mentioned error when I use this code:

i=1
for train_set,test_set in skf.split(x,y):
print('{} of SKFold {}'.format(i,skf.n_splits))
xtr,xvl = x.iloc[train_set],x.iloc[test_set]
ytr,yvl = y.iloc[train_set],y.iloc[test_set]

#model
model.fit(xtr,ytr)
score = roc_auc_score(yvl, model.predict(xvl), multi_class='ovr')
print('ROC AUC score:',score)
cv_score.append(score)    
pred_test = model.predict_proba(x_test)[:,1]
pred_test_full +=pred_test
i+=1

The value 'model' is as follows:

model = LogisticRegression(random_state=0, multi_class='multinomial', 
                            penalty='none', solver='newton-cg').fit(x_train, y_train)

What should I do to fix this?

Deanda
  • 1
  • Can you please give the error message? or give on which step the error happened? – Jithin P James May 21 '21 at 06:27
  • You could also use - `from sklearn.model_selection import train_test_split` and `X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.15)` for spliting the data – Jithin P James May 21 '21 at 06:28

0 Answers0