You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mahout.apache.org by "Dmitriy Lyubimov (Commented) (JIRA)" <ji...@apache.org> on 2011/12/12 04:18:32 UTC

[jira] [Commented] (MAHOUT-797) MapReduce SSVD: provide alternative B-pipeline per B=R' ^{-1} Y'A

    [ https://issues.apache.org/jira/browse/MAHOUT-797?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13167327#comment-13167327 ] 

Dmitriy Lyubimov commented on MAHOUT-797:
-----------------------------------------

Hm... can't seem to get R to compute either Cholesky or inverse. Here is the function . 

When i run it without something called pivot, i get "matrix not positive definite". with pivot the computation seems to proceed with warning but the system is reported as singular at attempt to obtain the inverse: 

{quote}
Error in solve.default(R) : 
  system is computationally singular: reciprocal condition number = 1.91281e-25
In addition: Warning messages:
1: In chol.default(yty, pivot = T) : matrix not positive definite
2: In chol.default(yty, pivot = T) : matrix not positive definite
{quote}

{code:title=svd.R}

#SSVD with Q=YR^-1 substitute.
# this is just a simulation, because it is suboptimal to verify the actual result
ssvd.svd1 <- function(x, k, p=25, qiter=0 ) { 

a <- as.matrix(x)
m <- nrow(a)
n <- ncol(a)
p <- min( min(m,n)-k,p)
r <- k+p

omega <- matrix ( rnorm(r*n), nrow=n, ncol=r)

# in reality we of course don't need to form and persist y
# but this is just verification
y <- a %*% omega

yty <- t(y) %*% y
R <- chol(yty, pivot = T)
q <- y %*% solve(R)

b<- t( q ) %*% a   

#power iterations
for ( i in 1:qiter ) { 
  y <- a %*% t(b)

  yty <- t(y) %*% y
  R <- chol(yty, pivot = T)
  q <- y %*% solve(R)
  b <- t(q) %*% a
}

bbt <- b %*% t(b)

e <- eigen(bbt, symmetric=T)

res <- list()

res$svalues <- sqrt(e$values)[1:k]
uhat=e$vectors[1:k,1:k]

res$u <- (q %*% e$vectors)[,1:k]
res$v <- (t(b) %*% e$vectors %*% diag(1/e$values))[,1:k]

return(res)
}
{code}
                
> MapReduce SSVD: provide alternative B-pipeline per B=R' ^{-1} Y'A
> -----------------------------------------------------------------
>
>                 Key: MAHOUT-797
>                 URL: https://issues.apache.org/jira/browse/MAHOUT-797
>             Project: Mahout
>          Issue Type: Improvement
>    Affects Versions: 0.5, 0.6
>            Reporter: Dmitriy Lyubimov
>            Assignee: Dmitriy Lyubimov
>             Fix For: Backlog
>
>         Attachments: MAHOUT-797.pdf
>
>   Original Estimate: 48h
>  Remaining Estimate: 48h
>
> Since alternative flow using Cholesky decomposition is extremely easy to add to existing computations of BB', I am thinking of just adding an option that chooses between B-pipeline with QR step and B-pipeline with Y'Y-Cholesky step. 
> Ongoing work and some initial code (Y'Y step) is here https://github.com/dlyubimov/mahout-commits/tree/MAHOUT-797.
> I also want to fix what's left unfixed in MAHOUT-638.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira