python - IndexError : index out of bounds -
i have implemented multinomialnb message. please me solve it. here code : kf = kfold(len(x), n_folds=2, shuffle=true, random_state=9999) model_train_index = [] model_test_index = [] model = 0 k, (index_train, index_test) in enumerate(kf): x_train, x_test, y_train, y_test = x.ix[index_train,:], x.ix[index_test,:],y[index_train], y[index_test] clf = multinomialnb(alpha=0.1).fit(x_train, y_train) score = clf.score(x_test, y_test) f1score = f1_score(y_test, clf.predict(x_test)) precision = precision_score(y_test, clf.predict(x_test)) recall = recall_score(y_test, clf.predict(x_test)) print('model %d has accuracy %f | f1score: %f | precision: %f | recall : %f'%(k,score, f1score, precision, recall)) model_train_index.append(index_train) model_test_index.append(index_test) model+=1 and result : indexerror traceback (most recent call last) <ipython-input-3-df0b24edb687>...