《机器学习实战》 ── Machine learning in action
作者:[美] Peter Harrington 著,李锐,李鹏,曲亚东 等 译
在所有笔记中搜索你感兴趣的关键词!
作者:[美] Peter Harrington 著,李锐,李鹏,曲亚东 等 译
功能:进行训练集和测试集的随机切分
X_train,X_test, y_train, y_test =sklearn.model_selection.train_test_split(sample_data,sample_target,test_size=0.25, train_size=None,random_state=0,stratify=y_train)
import numpy as np
from sklearn.model_selection import train_test_split
X, y = np.arange(10).reshape((5, 2)), range(5)
X_train, X_test, y_train, y_test = train_test_split(
X, y, test_size=0.33, random_state=42)
评论 (0)