diff --git a/iris_stack.py b/iris_stack.py index a4ee9c3..b9fe10b 100644 --- a/iris_stack.py +++ b/iris_stack.py @@ -38,4 +38,26 @@ scores = model_selection.cross_val_score(clf, x, y, cv = 3, scoring='accuracy') print("Accuracy: %0.2f (+/- %0.2f) [%s]" - % (scores.mean(), scores.std(), label)) \ No newline at end of file + % (scores.mean(), scores.std(), label)) + + +import matplotlib.pyplot as plt +from mlxtend.plotting import plot_decision_regions +import matplotlib.gridspec as gridspec +import itertools + +gs = gridspec.GridSpec(2, 2) + +fig = plt.figure(figsize=(10,8)) + +for clf, lab, grd in zip([clf1, clf2, clf3, sclf], + ['KNN', + 'Random Forest', + 'Naive Bayes', + 'StackingClassifier'], + itertools.product([0, 1], repeat=2)): + + clf.fit(X, y) + ax = plt.subplot(gs[grd[0], grd[1]]) + fig = plot_decision_regions(X=X, y=y, clf=clf) + plt.title(lab)