set.seed(2023)
rDim <- 20
cDim <- 20
n <- 100
y <- sample(1:2, n, TRUE, c(0.5, 0.5))
x <- array(rnorm(rDim*cDim*n), dim=c(rDim, cDim, n))
x[, , y==2] <- (x[, , y==2] + 1.0)
ntest <- 200
ytest <- sample(1:2, ntest, TRUE, c(0.5, 0.5))
xtest <- array(rnorm(rDim*cDim*ntest), dim=c(rDim, cDim, ntest))
xtest[, , ytest==2] <- (xtest[, , ytest==2] + 1.0)
## Uniform partition
print( plfd(x, y, r0=5, c0=5) )
## Pre-specify feature blocks
blockList <- list(list(rIdx=1:5, cIdx=1:5),
list(rIdx=6:10, cIdx=1:5),
list(rIdx=3:9, cIdx=2:8))
print( plfd.model <- plfd(x, y, blockList=blockList) )
## Predict
predict(plfd.model, xtest, ytest)
Run the code above in your browser using DataLab