Chapter 9 notebook minor issues
- Dominant language
- Jupyter Notebook
- Stars
- 30k
- Forks
- 13.1k
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
It seems that there are somes issues or differences with my execution of the chapter 9 handbook.
My configuration :
```
print(sys.version_info)
print(sklearn.__version__)
print(np.__version__)
print(mpl.__version__)
```
> sys.version_info(major=3, minor=8, micro=5, releaselevel='final', serial=0)
> 0.23.2
> 1.19.2
> 3.3.2
>
**9.1 : Iris classification and GaussianMixture**
It seems that the mapping of the prediction has changed in the GaussianMixture class in the sklearn version I use. Here is the code that works in my case :
```
y_pred = GaussianMixture(n_components=3, random_state=42).fit(X).predict(X)
mapping = np.array([1, 2, 0])
y_pred = np.array([mapping[cluster_id] for cluster_id in y_pred])
```
**9.1.1 : plot_centroid function**
The size of the cross is not correct in the handbook : it creates this (i used a different random_state for input data) :

instead of this :

This image was generated with the following code :
```
def plot_centroids(centroids, weights=None, circle_color='w', cross_color='k'):
if weights is not None:
centroids = centroids[weights > weights.max() / 10]
plt.scatter(centroids[:, 0], centroids[:, 1],
marker='o', s=50, linewidths=8,
color=circle_color, zorder=10, alpha=0.9)
plt.scatter(centroids[:, 0], centroids[:, 1],
marker='x', s=50, linewidths=2,
color=cross_color, zorder=11, alpha=1)
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.