R语言-数据处理-样本集划分

library(caret)测试

 1 > sIndex<-createDataPartition(outp$V1,p=0.7,list=FALSE)  2 > outpTrain<-outp[sIndex]  3 > outpTest<-outp[-sIndex]  4 > describe(outpTrain)  5 outpTrain  6        n  missing distinct     Info     Mean      Gmd      .05      .10 
 7      139        0      125        1    21.45    3.894    16.11    17.41 
 8      .25      .50      .75      .90      .95 
 9    19.19    21.66    23.54    25.62    27.20 
10 
11 lowest : 12.04 12.62 13.03 14.45 14.61, highest: 27.70 27.95 28.16 29.45 31.30
12 > describe(outpTest) 13 outpTest 14        n  missing distinct     Info     Mean      Gmd      .05      .10 
15       56        0       55        1    21.75    3.586    16.99    17.48 
16      .25      .50      .75      .90      .95 
17    19.39    21.66    23.50    24.91    27.08 
18 
19 lowest : 15.75 16.03 16.78 17.06 17.41, highest: 26.15 26.97 27.41 28.58 32.30

PS:根据因变量特征值进行数据分区,outp$V1 其中outp为因变量列表,V1为特征值的namespa

按照p=0.7划分,训练集占70%,测试集占30%,对划分的结果进行描述describe可知code

训练集 均值21.45  测试集均值21.75 blog

可是有一点疑问,测试集最小5个数值均小于测试集最小值???,如何更均匀??it

相关文章
相关标签/搜索