# NOT RUN {
# }
# NOT RUN {
# }
# NOT RUN {
# The following two examples demonstrate two equivalent ways of passing the same
# 3D quadratic active function to the afCEC routine:
# 1) Using "quadratic" value (default):
library(afCEC);
data(airplane);
result <- afCEC(airplane, 17);
# what is equivalent to:
library(afCEC);
data(airplane);
result <- afCEC(airplane, 17, values="quadratic");
# 2) Using the matrix containing the explicit values of the active function
# across the subsequent dimensions:
library(afCEC);
data(airplane);
values = matrix(rep(0, 5*3*dim(airplane)[1]), 5*3, dim(airplane)[1]);
for (i in 1:dim(airplane)[1]) {
tmp <- airplane[i,2:3];
for (j in 1:3) {
values[((j - 1) * 5) + 1, i] <- tmp[1]^2;
values[((j - 1) * 5) + 2, i] <- tmp[2]^2;
values[((j - 1) * 5) + 3, i] <- tmp[1];
values[((j - 1) * 5) + 4, i] <- tmp[2];
values[((j - 1) * 5) + 5, i] <- 1;
if (j < 3) tmp[j] <- airplane[i,j];
}
}
result <- afCEC(airplane, 17, values=values);
# }
Run the code above in your browser using DataLab