全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
6351 5
2014-03-14
怎么用SAS提取训练集和预测集  求程序




二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2014-3-14 23:11:22
1。设随机变量Key= ranuni(), 这样所有的obs都有一个介于0与1之间的值,根据你想要的训练集与测试集的比例提取,比如说2:1的话,可以提取 该值在0.21 ===0.87 为训练集,余下的为测试集。
2。 proc surveyselect 更为容易。参见如下link:
https://support.sas.com/document ... urveyselect_toc.htm

希望有帮助。
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2014-3-14 23:13:50
这是其中一个采用简单随机抽样的例子:

Simple Random Sampling  



The following PROC SURVEYSELECT statements select a probability sample of customers from the Customers data set by using simple random sampling:

   title1 'Customer Satisfaction Survey';
   title2 'Simple Random Sampling';
   proc surveyselect data=Customers
      method=srs n=100 out=SampleSRS;
   run;


The PROC SURVEYSELECT statement invokes the procedure. The DATA= option names the SAS data set Customers as the input data set from which to select the sample. The METHOD=SRS option specifies simple random sampling as the sample selection method. In simple random sampling, each unit has an equal probability of selection, and sampling is without replacement. Without-replacement sampling means that a unit cannot be selected more than once. The N=100 option specifies a sample size of 100 customers. The OUT= option stores the sample in the SAS data set named SampleSRS.
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2014-3-17 21:06:21
谢谢
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2014-4-1 23:18:50
殇诚 发表于 2014-3-17 21:06
谢谢
我已经有了训练集和测试集,求matlab程序,用训练集测试 测试集,求准确率
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2014-4-2 08:25:05
殇诚 发表于 2014-4-1 23:18
我已经有了训练集和测试集,求matlab程序,用训练集测试 测试集,求准确率
这是SAS专版。。。
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群