Skip to content

Commit

Permalink
print number of features in ch04
Browse files Browse the repository at this point in the history
  • Loading branch information
rasbt committed Jun 7, 2018
1 parent 24b74d2 commit 931a202
Show file tree
Hide file tree
Showing 3 changed files with 168 additions and 149 deletions.
290 changes: 145 additions & 145 deletions code/ch04/ch04.ipynb

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions code/ch04/ch04.py
Original file line number Diff line number Diff line change
Expand Up @@ -613,8 +613,8 @@ def _calc_score(self, X_train, y_train, X_test, y_test, indices):

sfm = SelectFromModel(forest, threshold=0.1, prefit=True)
X_selected = sfm.transform(X_train)
print('Number of samples that meet this criterion:',
X_selected.shape[0])
print('Number of features that meet this threshold criterion:',
X_selected.shape[1])


# Now, let's print the 3 features that met the threshold criterion for feature selection that we set earlier (note that this code snippet does not appear in the actual book but was added to this notebook later for illustrative purposes):
Expand Down
23 changes: 21 additions & 2 deletions docs/errata/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ To turn those annoyances into something positive, I will donate $5 to [UNICEF US
Also below, I added a small leaderboard to keep track of the errata submissions and errors you found. Please let me know if you don't want to be explicitely mentioned in that list!


- Amount for the next donation: 65$
- Amount for the next donation: 70$
- Amount donated: 0$


Expand All @@ -18,11 +18,11 @@ Contributor list:

7. gabramson ($15)
1. Gogy ($10)
6. Oliver Tomic ($10)
2. Christian Geier ($5)
3. Pieter Algra / Carlos Zada ($5)
4. @gabramson ($5)
5. Elias Strehle ($5)
6. Oliver Tomic ($5)
7. Krishna Mohan ($5)
8. Jesse Blocher ($5)

Expand Down Expand Up @@ -81,6 +81,25 @@ instead of

It seems that I did it correctly in the notebook. Also, the list of feature importances and the plot seem to be correct in the book. However, somehow the [indices] array index went missing in the print version.

pg. 138

Instead of writing

```
>>> print('Number of samples that meet this criterion:',
... X_selected.shape[0])
Number of samples that meet this criterion: 124
```

it would make more sense to write

```
>>> print('Number of features that meet this threshold criterion:',
... X_selected.shape[1])
Number of features that meet this threshold criterion: 5
```



pg. 155

Expand Down

0 comments on commit 931a202

Please sign in to comment.