Skip to content

Commit

Permalink
Update iris_stack.py
Browse files Browse the repository at this point in the history
  • Loading branch information
ShaoQiBNU authored Sep 21, 2018
1 parent cf3529c commit edf2b7e
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion iris_stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
% (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)

0 comments on commit edf2b7e

Please sign in to comment.