[BUG] Ch07 - Bagging and Pasting in Scikit-Learn, import numpy
- Dominant language
- Jupyter Notebook
- Stars
- 14.1k
- Forks
- 5.3k
- PR merge metrics
- No merged PRs in 30d
Description
One just need to import numpy herein as np, as exemplified below:
```
import numpy as np
def plot_decision_boundary(clf, X, y, alpha=1.0):
axes=[-1.5, 2.4, -1, 1.5]
x1, x2 = np.meshgrid(np.linspace(axes[0], axes[1], 100),
np.linspace(axes[2], axes[3], 100))
X_new = np.c_[x1.ravel(), x2.ravel()]
y_pred = clf.predict(X_new).reshape(x1.shape)
plt.contourf(x1, x2, y_pred, alpha=0.3 * alpha, cmap='Wistia')
plt.contour(x1, x2, y_pred, cmap="Greys", alpha=0.8 * alpha)
colors = ["#78785c", "#c47b27"]
markers = ("o", "^")
for idx in (0, 1):
plt.plot(X[:, 0][y == idx], X[:, 1][y == idx],
color=colors[idx], marker=markers[idx], linestyle="none")
plt.axis(axes)
plt.xlabel(r"$x_1$")
plt.ylabel(r"$x_2$", rotation=0)
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.