GabrielNMF: Gabriel-type Bi-Cross-Validation for Non-negative Matrix...

View source: R/GabrielNMF.R

GabrielNMFR Documentation

Gabriel-type Bi-Cross-Validation for Non-negative Matrix Factorization

Description

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.

Usage

GabrielNMF(X, J = 3, nx = 5, ny = 5, ...)

Arguments

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.

Value

TestRecError : The reconstruction error calculated by Gabriel-style Bi-Cross Validation.

Author(s)

Koki Tsuyuzaki

References

Art B. Owen et. al., (2009). Bi-Cross-Validation of the SVD and the Nonnegative Matrix Factorization. The Annals of Applied Statistics

Examples

  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)
  }

rikenbit/nnTensor documentation built on July 4, 2023, 2:27 a.m.