Last active
July 6, 2022 10:48
-
-
Save lmorillas/50b5e94fb48d19125fd48ab055850f1f to your computer and use it in GitHub Desktop.
Uso de sklearn.model_selection para dividir un modelo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sklearn.model_selection import train_test_split | |
''' | |
Documentación https://scikit-learn.org/stable/modules/generated/sklearn.model_selection.train_test_split.html | |
divide un dataframe (df): | |
* 80% train | |
* 10% validate | |
* 10% test | |
''' | |
train, test_and_validate = train_test_split(df, test_size=0.2, random_state=42, stratify=df['class']) | |
test, validate = train_test_split(test_and_validate, test_size=0.5, random_state=42, stratify=test_and_validate['class']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment