Skip to content

Commit aba9431

Browse files
committed
accepted version
1 parent c1cac9c commit aba9431

22 files changed

+185
-176
lines changed

2d_jet_blade_true.Rdata

783 Bytes
Binary file not shown.

GP.R

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,36 +3,35 @@ eps <- 1e-8
33

44
# fit a Gaussian process model
55
GP.fit <- function(X, y, k, g=eps,
6-
init=rep(10, ncol(X)),
7-
lower=0.1, upper=1000){
6+
init=rep(10, ncol(X)),
7+
lower=0.1, upper=1000){
88
# X is the input
99
# y is output
1010
# k is the smoothness parameter in matern kernel
1111
# g is the nugget effect
1212
# init is the initial value of lengthscale parameter when performing optimization
1313
# lower is the lower bound of lengthscale parameter when performing optimization
1414
# upper is the upper bound of lengthscale parameter when performing optimization
15-
1615
if(is.null(dim(X))) X <- matrix(X, ncol = 1)
1716

1817
y <- scale(y, scale=FALSE)
1918

2019
n <- length(y)
2120
if(!is.null(k)){ # if the smoothness is given
22-
nlsep <- function(par, X, Y)
21+
obj <- function(par, X, Y)
2322
{
2423
theta <- par
2524
R <- sqrt(distance(t(t(X)*theta)))
2625
K <- matern.kernel(R, k=k)
2726
Ki <- solve(K+diag(g,n))
28-
ldetK <- determinant(K, logarithm=TRUE)$modulus
29-
ll <- - (n/2)*log(t(Y) %*% Ki %*% Y) - (1/2)*ldetK
30-
return(-ll)
27+
28+
loocv <- mean((diag(1/diag(Ki)) %*% Ki %*% Y)^2)
29+
return(loocv)
3130
}
3231

3332
tic <- proc.time()[3]
3433

35-
outg <- optim(init, nlsep,
34+
outg <- optim(init, obj,
3635
method="L-BFGS-B", lower=lower, upper=upper, X=X, Y=y)
3736
toc <- proc.time()[3]
3837

@@ -43,30 +42,25 @@ GP.fit <- function(X, y, k, g=eps,
4342
loocv.save <- rep(0,length(k.candidate))
4443

4544
for(i in 1:length(k.candidate)){
46-
nlsep <- function(par, X, Y)
45+
obj <- function(par, X, Y)
4746
{
4847
theta <- par
4948
R <- sqrt(distance(t(t(X)*theta)))
5049
K <- matern.kernel(R, k=k.candidate[i])
5150
Ki <- solve(K+diag(g,n))
52-
ldetK <- determinant(K, logarithm=TRUE)$modulus
53-
ll <- - (n/2)*log(t(Y) %*% Ki %*% Y) - (1/2)*ldetK
54-
return(-ll)
51+
loocv <- mean((diag(1/diag(Ki)) %*% Ki %*% Y)^2)
52+
return(loocv)
5553
}
5654

5755
tic <- proc.time()[3]
5856

59-
outg <- optim(init, nlsep,
57+
outg <- optim(init, obj,
6058
method="L-BFGS-B", lower=lower, upper=upper, X=X, Y=y)
6159
toc <- proc.time()[3]
6260

6361
theta.save[i,] <- outg$par
6462

65-
R <- sqrt(distance(t(t(X)*theta.save[i,])))
66-
K <- matern.kernel(R, k=k.candidate[i])
67-
Ki <- solve(K+diag(g,n))
68-
69-
loocv.save[i] <- mean((diag(1/diag(Ki)) %*% Ki %*% y)^2)
63+
loocv.save[i] <- outg$value
7064
}
7165
k <- k.candidate[which.min(loocv.save)]
7266
theta <- theta.save[which.min(loocv.save),]

Rmatlab_files/.DS_Store

0 Bytes
Binary file not shown.
Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
"X2...X...1","rep.MM.tt.l..n."
2-
0,0.0125
3-
0.5,0.0125
4-
-0.5,0.0125
5-
-0.25,0.0125
6-
0.75,0.0125
1+
"X1","X2","rep.MM.tt.l..n."
2+
0.453125,0.703125,0.05
3+
0.390625,0.390625,0.05
4+
0.640625,0.640625,0.05
5+
0.515625,0.265625,0.05
6+
0.265625,0.515625,0.05
7+
0.2734375,0.3828125,0.05
8+
0.5234375,0.6328125,0.05
Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
0,0.012500000000000000693889390390723,0.39971446424469275759960851246433,1.311069999999999957651652948698
2-
0.5,0.012500000000000000693889390390723,0.51639448598742210272405372961657,0.56689658300000000945573219723883
3-
-0.5,0.012500000000000000693889390390723,0.31309325845750018979529727403133,0.49697162499999997242738913882931
4-
-0.25,0.012500000000000000693889390390723,0.35323817107758859190624889379251,0.40993395900000001441654262634984
5-
0.75,0.012500000000000000693889390390723,0.58955524643800005790694740426261,0.56776395899999998473361983997165
1+
0.453125,0.703125,0.050000000000000002775557561562891,21.12135924143782617079523333814,1.6989625420000000755038627175963
2+
0.390625,0.390625,0.050000000000000002775557561562891,4.4355911525197075917503752862103,0.84547937500000003296918293926865
3+
0.640625,0.640625,0.050000000000000002775557561562891,7.2743694901323232571144217217807,0.81774108300000003524132807797287
4+
0.515625,0.265625,0.050000000000000002775557561562891,18.263094761612002514539199182764,0.70163470800000005134222647029674
5+
0.265625,0.515625,0.050000000000000002775557561562891,19.733075703317034310657618334517,0.9584084579999999631283458256803
6+
0.2734375,0.3828125,0.050000000000000002775557561562891,9.8450206901014389870852028252557,0.7251950000000000340349970429088
7+
0.5234375,0.6328125,0.050000000000000002775557561562891,12.053113630961497904081625165418,0.67546404100000001502479562986991

alpha_estimation.pdf

6.75 KB
Binary file not shown.

alpha_estimation_blade.pdf

5.65 KB
Binary file not shown.

alpha_estimation_poisson.pdf

6.35 KB
Binary file not shown.

blade_design.pdf

7.99 KB
Binary file not shown.

blade_design_size.pdf

5.38 KB
Binary file not shown.

0 commit comments

Comments
 (0)