您的訂閱是我製作影片的動力
訂閱點這裡~
若內容有誤,還請留言指正,謝謝您的指教
#影片程式碼
#延續DAY22
library(e1071)
tune.model <- tune.svm(Sepal.Length~.,data=traindata,type="eps-regression",kernel="radial",
range=list(cost = 2^c(-8,-4,-2,0), epsilon = seq(0,10,0.1)))
tune.model$best.model #挑 lowest MSE
model <- svm(Sepal.Length~.,data=traindata,type="eps-regression",kernel="radial",cost=1,epsilon=0.1,gamma=0.3333333)
future <- predict(model,testdata)
future <- as.data.frame(future)
final <- cbind(future,testdata)
library(dplyr)
final <- mutate(final,mape=abs(future-Sepal.Length)/Sepal.Length)
mean(final$mape)