ageron / ageron/handson-ml2

[QUESTION] Chapter 9 Label propagation

Open
#564 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
30k
Forks
13.1k
PR merge metrics
No merged PRs in 30d

Description

I dont get these lines of the code

```python
k=50
y_representative_digits = np.array([4, 8, 0, 6, 8, 3, ..., 7, 6, 2, 3, 1, 1])
y_train_propagated = np.empty(len(X_train), dtype=np.int32)

for i in range(k):
y_train_propagated[kmeans.labels_==i] = y_representative_digits[i]
```

If for example the `i` of the for loop is 2. Then the indices of `y_train_propagated[kmeans.labels_==i]` (where `kmeans.labels_==2` is true) will be set to 0 because `y_representative_digits[2]` is equivalent to 0, right?

So the indices of `y_train_propagated` where `kmeans.labels_` is equal to 2 will be set to zero. The label is 2 but it is set to 0. Wouldn't that be wrong?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.