Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何从GA超参数调整中获得RMSE值?_R_Hyperparameters - Fatal编程技术网

如何从GA超参数调整中获得RMSE值?

如何从GA超参数调整中获得RMSE值?,r,hyperparameters,R,Hyperparameters,我找到了使用GA进行超参数调整的R代码。下面是代码,但它没有显示预期的结果,这将是预测精度?我在问题的末尾提到了它产生的输出,但我希望输出的RMSE值为,0.44、0.23、0.1等 代码如下: d=readARFF("soft.arff") index <- createDataPartition(d$Effort, p = .70,list = FALSE) tr <- d[index, ] ts <- d[-index, ] svm_fit <- function

我找到了使用GA进行超参数调整的R代码。下面是代码,但它没有显示预期的结果,这将是预测精度?我在问题的末尾提到了它产生的输出,但我希望输出的RMSE值为,0.44、0.23、0.1等

代码如下:

d=readARFF("soft.arff")
index <- createDataPartition(d$Effort, p = .70,list = FALSE)
tr <- d[index, ]
ts <- d[-index, ] 
svm_fit <- function(x) {
  mod <- train(Rank ~ ., data = tr,
               method = "svmRadial",
               preProc = c("center", "scale"),
               trControl = trainControl(method = "cv"),
               tuneGrid = data.frame(C = 2^x[1], sigma = exp(x[2])))
  -getTrainPerf(mod)[, "TrainRMSE"]
}

svm_ga_obj <- GA::ga(type = "real-valued", 

                            fitness = svm_fit,              

                                  min = c(-5, -5), 
                                  max = c(5, 0), 
                                  popSize = 50, 
                                  maxiter = 2,
                                  seed = 16478,
                                  keepBest = TRUE,
                                  monitor = NULL,
                                  elitism = 2)

summary(svm_ga_obj)

问题是什么?我如何获得RMSE的值?

请包括您用于此代码的程序包,以运行库(e1071)库(mlr)库(插入符号)、库(GA)、库(farff)
GA settings: 
Type                  =  real-valued 
Population size       =  50 
Number of generations =  2 
Elitism               =  2 
Crossover probability =  0.8 
Mutation probability  =  0.1 
Search domain = 
      x1 x2
lower -5 -5
upper  5  0

GA results: 
Iterations             = 2 
Fitness function value = -6309.072 
Solution = 
          x1        x2
[1,] 4.80478 -4.202595