美文网首页学习/影视资源库
train_test_split()的各参数详解

train_test_split()的各参数详解

作者: 一只不会南飞的燕 | 来源:发表于2020-05-17 22:42 被阅读0次

from sklearn.model_selection import train_test_split

x_train,x_test,y_train,y_test=train_test_split(x,y,test_size=0.3,random_state=0)

x:样本特征集

y:样本的标签集

test_size:样本占比,测试集占数据集的比重,如果是整数的话就是样本的数量

random_state:是随机数的种子。在同一份数据集上,相同的种子产生相同的结果,不同的种子产生不同的划分结果

x_train,y_train:构成了训练集

x_test,y_test:构成了测试集


我是一只不会南飞的燕!

相关文章

网友评论

    本文标题:train_test_split()的各参数详解

    本文链接:https://www.haomeiwen.com/subject/nqieohtx.html