在R.
在寻找捕获函数时,我得到了指定的错误。我被困了好几个小时。任何帮助都是值得感激的。
#install packages
library(DiceKrigging)
library(DiceOptim)
library(lhs)
nsteps <- 10
d=6
lower <- c(-2,-2,-2,0,0,0)
upper <- c(5,5,5,1,10,10)
X=lhs(n,d)
colnames(X)=c("x1","x2","x3","x4","x4","x5","x6")
Temp=c(1:n)
mf2 <- km(~ 1+x1+sin(x2) +x3+I(x4^-1)+x5+x6, design = X,
response=Temp,covtype="matern5_2",
nugget=epsilon,multistart = 5,control=list(maxit=500,trace=T,popsize=50))
model <- mf2
f1 <- function(X) { x1 <- x[1]
x2 <- x[2]
x3 <- x[3]
x4 <- x[4]
x5 <- x[5]
x6 <- x[6]
L=-111.563*x1-29.81*sin(x2)+35.202*x3-.00012485/x4-1.045997*x5+11.6344*x6+13.1035
return(L)
}
oEGO <- EGO.nsteps(model = mf2, fun = f1, nsteps = nsteps,
+ lower, upper, control = list(pop.size = 20, BFGSburnin = 2))
----------当我运行最后一段代码时,它显示的是: y.predict.trend + y.predict.complement中的错误:不符合的数组。
发布于 2017-11-23 02:51:23
我修改了代码,看看:
#install packages
library(DiceKriging)
library(DiceOptim)
library(lhs)
nsteps <- 10
n <- 10
d <- 6
lower <- c(-2,-2,-2,0,0,0)
upper <- c(5,5,5,1,10,10)
x <- randomLHS(n,d)
colnames(x)=c("x1","x2","x3","x4","x5","x6")
Temp=c(1:n)
mf2 <- km(~ 1+x1+sin(x2)+x3+I(x4^-1)+x5+x6,
design = X,
response=Temp,
covtype="matern5_2",
nugget = NULL, nugget.estim=FALSE,
multistart = 5,
control=list(maxit=500,trace=T,popsize=50))
f1 <- function(x) {
x1 <- x[1]
x2 <- x[2]
x3 <- x[3]
x4 <- x[4]
x5 <- x[5]
x6 <- x[6]
L=-111.563*x1-29.81*sin(x2)+35.202*x3-.00012485/x4-1.045997*x5+11.6344*x6+13.1035
return(L)
}
oEGO <- EGO.nsteps(mf2,f1,nsteps,lower,upper)你正在得到一些结果,但我不确定这是否是你想要的。如果你需要澄清,请告诉我。
https://datascience.stackexchange.com/questions/25002
复制相似问题