Here is my code im building 6 models and i am getting accuracy in that, how do i choose that dynamically which accuracy is greater and i want to execute only that model which as highest accuracy.
"prepare configuration for cross validation test harness"seed = 7"prepare models"models = []
models.append(('LR', LogisticRegression()))
models.append(('LDA', LinearDiscriminantAnalysis()))
models.append(('KNN', KNeighborsClassifier()))
models.append(('CART', DecisionTreeClassifier()))
models.append(('NB', GaussianNB()))
models.append(('RF',RandomForestClassifier()))#models.append(('SVM', SVC()))"evaluate each model in turn"results = []
names = []
scoring = 'accuracy'
for name, model in models:kfold = model_selection.KFold(n_splits=10, random_state=seed)cv_results = model_selection.cross_val_score(model, orginal_telecom_80p_test[features], orginal_telecom_80p_test["Churn"], cv=kfold, scoring=scoring)results.append(cv_results)names.append(name)msg = "%s: %f (%f)" % (name, cv_results.mean(), cv_results.std())print(msg)
This is my accuracy
LR: 0.787555 (0.039036)
LDA: 0.780460 (0.039821)
KNN: 0.759916 (0.030417)
CART: 0.706669 (0.035827)
NB: 0.731637 (0.050813)
RF: 0.752054 (0.048660)