ageron / ageron/handson-ml

Visualizing Decision Boundaries

Abierto
#501 5 comentarios 1 reacción 0 asignados Ver en GitHub
Lenguaje dominante
Jupyter Notebook
Estrellas
25.6k
Forks
12.7k
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

Hi Aurelien,

Thanks a lot for your book, it helps me a lot to understand the basic concepts in a practical way.
Can you please help me to understand the below code in general visualizing Decision Boundaries.

```python
def plot_predictions(clf, axes):
x0s = np.linspace(axes[0], axes[1], 100)
x1s = np.linspace(axes[2], axes[3], 100)
x0, x1 = np.meshgrid(x0s, x1s)
X = np.c_[x0.ravel(), x1.ravel()]
y_pred = clf.predict(X).reshape(x0.shape)
y_decision = clf.decision_function(X).reshape(x0.shape)
plt.contourf(x0, x1, y_pred, cmap=plt.cm.brg, alpha=0.2)
plt.contourf(x0, x1, y_decision, cmap=plt.cm.brg, alpha=0.1)

plot_predictions(polynomial_svm_clf, [-1.5, 2.5, -1, 1.5])
plot_dataset(X, y, [-1.5, 2.5, -1, 1.5])

save_fig("moons_polynomial_svc_plot")
plt.show()
```

I understand that we create features using `linspace` to use them for getting predictions.
But I am unable to understand how predictions in `contourf` visualizes decision boundary.

Also, regarding the part 2 of the book what steps should we follow to use with latest version of TensorFlow.

Thanks a lot in advance.

Regards
Deepak.

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.