Coder Social home page Coder Social logo

Comments (1)

dimalvovs avatar dimalvovs commented on August 25, 2024

A workaround to this issue is converting the object with as.matrix() and then passing to CoGAPS with sparseOptimization=TRUE. C++ code would still convert the matrix to sparse format and the final results are the same. The downside seems to be the increased RAM consumption as the resulting matrix is bigger. Proof of result equality below (interestingly sparse->dense->sparse takes less time to compute than sparse from file):

> library("CoGAPS")
> 
> path <- 'normalized.mtx'
> 
> message('dense with conversion')
dense with conversion
> tictoc::tic()
> mat <- Matrix::readMM(path)
mat <- as.matrix(mat)
res1 <- CoGAPS(mat, nIterations=100, messages=FALSE, sparseOptimization=TRUE, nPatterns=2, seed=5)
tictoc::toc()
> mat <- as.matrix(mat)
Warning message:
In asMethod(object) :
  sparse->dense coercion: allocating vector of size 1.3 GiB
> res1 <- CoGAPS(mat, nIterations=100, messages=FALSE, sparseOptimization=TRUE, nPatterns=2, seed=5)

This is CoGAPS version 3.22.0 
Running Standard CoGAPS on mat (36601 genes and 4898 samples)
> tictoc::toc()
46.003 sec elapsed

> message('sparse from file')
sparse from file
> tictoc::tic()
> res2 <- CoGAPS(path, nIterations=100, messages=FALSE, sparseOptimization=TRUE, nPatterns=2, seed=5)
tictoc::toc()

This is CoGAPS version 3.22.0 
Running Standard CoGAPS on normalized.mtx (36601 genes and 4898 samples)
> tictoc::toc()
52.744 sec elapsed

> all.equal(res1, res2)
[1] "Attributes: < Component “metadata”: Component “totalRunningTime”: Mean relative difference: 0.03333333 >"

from cogaps.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.