I have created dummy variables using label encoder and i run my model but when i am checking accuracy of my model using K Fold and Cross validation i am getting Bad Input shape error. Please help to fix it
I have tried reshaping the model and also I have change my dummy variables creation using LabelEncoder
from sklearn.model_selection import train_test_split
columns = df_train.drop('default_ind',axis =1).columns
X_train, X_test, y_train, y_test = train_test_split(df_train[columns],
df_train, test_size = 0.3)
from sklearn.linear_model import LogisticRegression
from sklearn.tree import DecisionTreeClassifier
from sklearn.svm import SVC
from sklearn.neighbors import KNeighborsClassifier
from sklearn.naive_bayes import GaussianNB
from sklearn.ensemble import RandomForestClassifier
models=[]
models.append(("logreg",LogisticRegression(solver='liblinear')))
models.append(("tree",DecisionTreeClassifier()))
models.append(("forest",RandomForestClassifier(n_estimators=20)))
models.append(("svc",SVC()))
models.append(("knn",KNeighborsClassifier()))
models.append(("nb",GaussianNB()))
seed=7
scoring='accuracy'
from sklearn.model_selection import KFold
from sklearn.model_selection import cross_val_score
result=[]
names=[]
for name,model in models:
kfold=KFold(n_splits=5,random_state=seed)
cv_result=cross_val_score(model,X_train,y_train,cv=kfold,scoring=scoring)
result.append(cv_result)
names.append(name)
print("%s %f %f" % (name,cv_result.mean(),cv_result.std()))
I am not able to check the accuracy and getting below error
ValueError: bad input shape (335427, 32)