Я пытаюсь найти среднеквадратическую ошибку на модели ksvm, а также выводить результаты с использованием кадра данных airquality
.Это то, что я до сих пор:
library(kernlab)
library(ggplot2)
AQ <- airquality
set.seed(1)
randIndex <- sample(1:dim(AQ)[1])
cutPoint2_3<- floor(2 * dim(AQ)[1]/3)
cutPoint2_3
TrainAQ <- AQ[randIndex[1:cutPoint2_3],]
TestAQ <- AQ[randIndex[(cutPoint2_3+1) :dim(AQ)[1]],]
svmOutput <- ksvm(Ozone ~., data=TrainAQ, kernel = "rbfdot",
kpar='automatic',C=5,cross=3, prob.model=TRUE)
#Test the model on the testing dataset, and compute the Root Mean Squared Error
svmOutputtest <- ksvm(Ozone ~., data=TestAQ,
kernel = "rbfdot",
kpar="automatic",
C=5,
cross=3,
prob.model=TRUE)
#root mean squared is ?
#Plot the results. Use a scatter plot. Have the x-axis represent temperature, the y-axis represent wind, the point size and color represent the error, as defined by the actual ozone level minus the predicted ozone level).
ggplot(AQ,aes(x=Temp,y= Wind,color=svmOutput$Error,shape=svmOutput$Error)) +geom_point(size=5)