CH02: Use train_test_split instead of StratifiedShuffleSplit
- Lenguaje dominante
- Jupyter Notebook
- Estrellas
- 25.6k
- Forks
- 12.7k
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
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!
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Evaluación
Este issue todavía no se ha evaluado.