Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #valores = final_dataset.values
- X = final_dataset.iloc[:,:-1]
- Y = final_dataset.iloc[:,-1]
- #Creamos un array con los modelos que emplearemos
- models = []
- models.append(('SVM', SVC(kernel='rbf')))
- models.append(('Naive_Bayes', GaussianNB()))
- models.append(('Decision_Trees', DecisionTreeClassifier()))
- results = []
- names = []
- for name, model in models:
- KF = KFold(n_splits=5)
- cv_results = cross_val_score(model, X, Y, cv=KF.get_n_splits(), scoring='accuracy')
- results.append(cv_results)
- names.append(name)
- msg = "%s: %f (%f)" % (name, cv_results.mean(), cv_results.std())
- print(msg)
- # boxplot algorithm comparison
- fig = plt.figure()
- fig.suptitle("Algorithm accuracy comparison")
- ax = fig.add_subplot(111)
- plt.boxplot(results)
- ax.set_xticklabels(names)
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement