“Zugtest geteilte Stratify” Code-Antworten

Zugtest Split 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

Pandas Split Train -Test

from sklearn.model_selection import train_test_split

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

Zugtest geteilte 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

Zugtest geteilte Python

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

So verteilen Sie einen Datensatz im Zug und Test mit 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

Ähnliche Antworten wie “Zugtest geteilte Stratify”

Fragen ähnlich wie “Zugtest geteilte Stratify”

Weitere verwandte Antworten zu “Zugtest geteilte Stratify” auf Python

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen