zdebruine / RcppML

Rcpp Machine Learning: Fast robust NMF, divisive clustering, and more
GNU General Public License v2.0
89 stars 15 forks source link

Matrix-related error in dev version of crossValidate #40

Closed rpolicastro closed 1 year ago

rpolicastro commented 1 year ago

Hello,

Matrix is throwing an error when trying to run crossValidate on the dev version of RcppML.

Relevant versions.

> R.Version()$version.string
[1] "R version 4.2.1 (2022-06-23)"
> packageVersion("RcppML")
[1] ‘0.5.6’
> packageVersion("Matrix")
[1] ‘1.5.1’

Reproducible example.

> RcppML::crossValidate(as.matrix(mtcars), k=1:5, rep=2)
Error: as(<ngCMatrix>, "dgCMatrix") is deprecated since Matrix 1.5-0; do as(., "dMatrix") instead
> traceback()
6: warning.(gettextf("as(<%s>, \"%s\") is deprecated since Matrix 1.5-0; do %s instead", 
       cln1, cln2, deparse1(.as.via.virtual(Class1, Class2, quote(.)))), 
       call. = FALSE, domain = NA)
5: Matrix.DeprecatedCoerce(cd1, cd2)
4: asMethod(object)
3: as(mask, "dgCMatrix")
2: nmf(data, rank, mask = mask_matrix, ...)
1: RcppML::crossValidate(as.matrix(mtcars), k = 1:5, rep = 2)

This error doesn't effect RcppML::nmf.

Cheers, Bob

rpolicastro commented 1 year ago

Restarting R changed this from an error to a warning, allowing crossValidate to run successfully. This appears to have been a session-specific bug, so will close.

zdebruine commented 1 year ago

Thanks @rpolicastro, this is a known warning from the latest release of the Matrix package, and part of a set of loosely-defined now-deprecated coercion methods. I will be addressing this during a makeover of the package this summer.

rpolicastro commented 1 year ago

Yea, for some reason it was throwing an error instead of a warning after first installing the package, so it wouldn't finish running the function. Thankfully a simple restart of R fixed the issue.

Besides that little hiccup the package has been great to work with thus far, and runs quite fast on our single-cell data.