from sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_test = train_test_split(
X, y, test_size=0.2, random_state=42, stratify=y
)
# Trénink / validace / test = 60 / 20 / 20
X_rest, X_test, y_rest, y_test = train_test_split(X, y, test_size=0.2, random_state=0)
X_train, X_val, y_train, y_val = train_test_split(X_rest, y_rest, test_size=0.25, random_state=0)
# Ručně
idx = np.random.default_rng(0).permutation(len(X))Test použij až na konci. Duplicity odstraň před dělením. Měřítka počítej jen z tréninku. Časové řady nemíchej.