We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 54fec24 commit d00b0d1Copy full SHA for d00b0d1
1 file changed
modelvis.py
@@ -17,4 +17,16 @@ def visClassifier2d(X, y, clf):
17
plt.contourf(xx1, xx2, z, cmap='viridis', alpha = 0.3)
18
plt.scatter(X[:,0], X[:,1], c = y, s = 50, cmap='bwr')
19
plt.show()
20
-
+
21
22
+def visClassifier2dProb(X, y, clf):
23
+ s = 1.1
24
+ x1_min, x1_max = X[:,0].min()*s, X[:,0].max()*s
25
+ x2_min, x2_max = X[:,1].min()*s, X[:,1].max()*s
26
+ xx1, xx2 = np.meshgrid(np.arange(x1_min, x1_max, (x1_max - x1_min)/100),
27
+ np.arange(x2_min, x2_max, (x2_max - x2_min)/100))
28
+ z = clf.predict_proba(np.c_[xx1.ravel(), xx2.ravel()])[:,0]
29
+ z = z.reshape(xx1.shape)
30
+ plt.contourf(xx1, xx2, z, cmap='viridis', alpha = 0.3)
31
+ plt.scatter(X[:,0], X[:,1], c = y, s = 50, cmap='bwr')
32
+ plt.show()
0 commit comments