GabrielNMF | R Documentation |
The input data is assumed to be non-negative matrix. GabrielNMF devides the input file into four matrices (A, B, C, and D) and perform cross validation by the prediction of A from the matrices B, C, and D.
GabrielNMF(X, J = 3, nx = 5, ny = 5, ...)
X |
The input matrix which has N-rows and M-columns. |
J |
The number of low-dimension (J < {N, M}). |
nx |
The number of hold-out in row-wise direction (2 < nx < N). |
ny |
The number of hold-out in row-wise direction (2 < ny < M). |
... |
Other parameters for NMF function. |
TestRecError : The reconstruction error calculated by Gabriel-style Bi-Cross Validation.
Koki Tsuyuzaki
Art B. Owen et. al., (2009). Bi-Cross-Validation of the SVD and the Nonnegative Matrix Factorization. The Annals of Applied Statistics
if(interactive()){
# Test data
matdata <- toyModel(model = "NMF")
# Bi-Cross-Validation
BCV <- rep(0, length=5)
names(BCV) <- 2:6
for(j in seq(BCV)){
print(j+1)
BCV[j] <- mean(GabrielNMF(matdata, J=j+1, nx=2, ny=2)$TestRecError)
}
proper.rank <- as.numeric(names(BCV)[which(BCV == min(BCV))])
# NMF
out <- NMF(matdata, J=proper.rank)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.