admm_nmr_fit: Fitting the ADMM algorithm for NMR

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/admm_nmr.R

Description

This function fit the ADMM algorithm for the nuclear norm regression. It returns the optimal regression coefficient vector. You can use the output of this function for classification.

Usage

1
admm_nmr_fit(max_iter, ep_abs, ep_rel, A, B)

Arguments

max_iter

Maximum number of iterations

ep_abs

Parameter used for termination conditions

ep_rel

Parameter used for termination conditions

A

"A" is a train data set in the form of a three-dimensional array. This data set contains several face images used for algorithm learning.

B

"B" is an image of a face with occlusion.

Value

X_new

"X_new" is the optimal regression coefficient vector.

Author(s)

Jisun Kang

References

https://ieeexplore.ieee.org/document/7420697

See Also

https://web.stanford.edu/~boyd/papers/pdf/admm_slides.pdf

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
function (max_iter, ep_abs, ep_rel, A, B)
{
    p <- dim(A)[1]
    q <- dim(A)[2]
    n <- dim(A)[3]
    h <- array(rep(0, p * q), dim = c(p * q, n))
    for (n_iter in 1:n) {
        h[, n_iter] <- as.vector(A[, , n_iter])
        M <- solve(t(H) %*% H + lambd/mu) %*% t(H)
    }
    Y <- -B
    Z <- 0
    k <- 0
    x <- rep(0, n)
    for (i in 1:max_iter) {
        g_in <- B + Y - 1/mu * Z
        g <- as.vector(g_in)
        x_new <- M %*% g
        A_x_new <- coef_img(A, x_new)
        Y_new <- svt(mu, A_x_new, B, Z)
        Z_new <- Z + mu * (A_x_new - Y_new - B)
        r_pri <- A_x_new - Y_new - B
        ep_pri <- ep_abs * sqrt(p * q) + ep_rel
        s_dual <- 1/mu * h %*% as.vector(Y - Y_new)
        ep_dual <- ep_abs * sqrt(n) + ep_rel
    }
    x <- x_new
    Y <- Y_new
    Z <- Z_new
    A_x <- A_x_new
    return(X_new)
  }

riverKangg/NuclearNormClassifier documentation built on Jan. 1, 2020, 10:08 p.m.