“Python de validación de datos divididos” Código de respuesta

Código para la prueba y división de trenes

from sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_test = train_test_split(
 X, y, test_size=0.33, random_state=42)
Cute Chimpanzee

Python de validación de datos divididos

import numpy as np
from sklearn.model_selection import train_test_split

X, y = np.arange(10).reshape((5, 2)), range(5)

# First: split data into train and test 
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.33, random_state=42)

# Second: use the train set to get the validation set and the final train set
X_train, X_val, y_train, y_val = train_test_split(X_train, y_train, test_size=0.33, random_state=42)

Gabriel Juri

Código para la prueba y división de trenes

from sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_test = train_test_split(X, y, 
	test_size = 0.33, random_state = 42)
Cute Chimpanzee

Respuestas similares a “Python de validación de datos divididos”

Preguntas similares a “Python de validación de datos divididos”

Más respuestas relacionadas con “Python de validación de datos divididos” en Python

Explore las respuestas de código populares por idioma

Explorar otros lenguajes de código