“Teste de trem Split Stratify” Respostas de código

Teste de trem dividido Sklearn

from sklearn.model_selection import train_test_split

X = df.drop(['target'],axis=1).values   # independant features
y = df['target'].values					# dependant variable

# Choose your test size to split between training and testing sets:
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.25, random_state=42)
The Frenchy

Teste de trem dividido de pandas

from sklearn.model_selection import train_test_split

train, test = train_test_split(df, test_size=0.2)
Courageous Cod

Teste de trem Split Stratify

As such, it is desirable to split the dataset into train and test sets in a way
that preserves the same proportions of examples in each class as observed in the
original dataset. 

from sklearn.model_selection import train_test_split

# Create training and test sets
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.3, 
random_state=42,stratify=y)
Fancy Falcon

Teste de trem Python dividido

from sklearn.model_selection import train_test_split
				
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.25, random_state=42)
JJSSEECC

Como distribuir um conjunto de dados em trem e teste usando o Scikit

from sklearn.model_selection import train_test_split
xTrain, xTest, yTrain, yTest = train_test_split(x, y, test_size = 0.2, random_state = 0)
Firoxon

Respostas semelhantes a “Teste de trem Split Stratify”

Perguntas semelhantes a “Teste de trem Split Stratify”

Mais respostas relacionadas para “Teste de trem Split Stratify” em Python

Procure respostas de código populares por idioma

Procurar outros idiomas de código