ageron / ageron/handson-ml2

Chap 3, more clarification for Never5Classifier(BaseEstimator)

Open
#480 2 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

```python
from sklearn.base import BaseEstimator
class Never5Classifier(BaseEstimator):
def fit(self, X, y=None):
pass
def predict(self, X):
return np.zeros((len(X), 1), dtype=bool)
```

I don't understand how this being created. I thought it would predict not-5 class is true, but whereas `y_train[1] == 0` , `never_5_clf.predict(X_train)` is still `False` for the `[1]` ?
plz explain how this classifier work. Which code represent it can predict the not-5?

![image](https://user-images.githubusercontent.com/57439364/136594683-d76f84e7-4f4f-4dbb-9b09-c4331067e00c.png)

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.