ageron / ageron/handson-ml

CH02: Use train_test_split instead of StratifiedShuffleSplit

オープン
#385 コメント 5 件 リアクション 17 件 担当者 0 名 GitHub で見る
主要言語
Jupyter Notebook
スター
25.6k
フォーク
12.7k
PR マージ指標
30日以内にマージされた PR はありません

説明

In CH02, the book uses StratifiedShuffleSplit to split data according to income category, maybe it's more user-friendly to use train_test_split
code from master:
```
from sklearn.model_selection import StratifiedShuffleSplit

split = StratifiedShuffleSplit(n_splits=1, test_size=0.2, random_state=42)
for train_index, test_index in split.split(housing, housing["income_cat"]):
strat_train_set = housing.loc[train_index]
strat_test_set = housing.loc[test_index]
```
updated version:
```
strat_train_set, strat_test_set = train_test_split(
housing, test_size=0.2, random_state=42, stratify=housing["income_cat"])
```
Thanks for the awesome book!

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。