数学建模案例分析.ppt

数学建模案例分析解读

* 二、、支持向量回归R语言实现 * Step1:导入数据 try-read.table(file=“f:\\data2/try.txt”,header=TRUE) #读入训练集数据; test-read.table(file=“f:\\data2/test.txt”,header=TRUE) #读入 检测集数据; try-as.matrix(try) # 数据转换矩阵形式 test-as.matrix(test) # 数据转换矩阵形式 * 二、、支持向量回归R语言实现 * Step2:采用几种常见核函数建模并比较 svm1-svm(y~.,try,kernel=linear) #使用线性核函数建模; svm2-svm(y~.,try,kernel=sigmoid) #使用sigmoid核函数建模; svm3-svm(y~.,try,kernel=radial)#使用高斯核函数建模; svm4-svm(y~.,try,kernel=polynomial) #使用多项式核函数建模; fy1-predict(svm1,test) fy2-predict(svm2,test) fy3-predict(svm3,test) fy4-predict(svm4,test) * 二、、支持向量回归R语言实现 * Step2:采用几种常见核函数建模并比较 e1-mean(((fy1-ty)/

文档评论(0)

1亿VIP精品文档

相关文档