Demo entry 6687512

RCORD

   

Submitted by anonymous on Dec 28, 2017 at 18:54
Language: RQL. Code size: 469 Bytes.

 install.packages('e1071')#加载e1071
   setwd("C:\\Users\\Administrator\\Desktop")#设置R的工作路径
   data<-read.csv(file='data.csv',header=TRUE)#读取数据
   head(data)#查看数据的前6
   dim(data)#查看数据的维度
   train<-data[1:2000,]#将数据集的前2000行数据作为样本数据
   test<-data[2000:length(data$Ot),]#将数据集后1317个数据作为训练集

   library(e1071)#调用e1071 
   #通过 tune.svm()函数进行参数的寻优
   tuned<-tune.svm(Ot~.,data=train,gamma = 10^(-6:-1),cost=10^(1:2))          
   tuned#返回寻优结果
   #使用svm()函数来构建模型

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).