Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem in nmf.LassoCV #4

Closed
luca-dex opened this issue Sep 20, 2018 · 5 comments · Fixed by #5
Closed

Problem in nmf.LassoCV #4

luca-dex opened this issue Sep 20, 2018 · 5 comments · Fixed by #5
Assignees
Labels

Comments

@luca-dex
Copy link
Collaborator

When running nmf.LassoCV with the args reported in the vignettes the following error is shown:

> cv = nmf.LassoCV(x=patients,K=3:10)
Performing a grid search to estimate the best values of K and lambda with a total of 10 cross validation repetitions... 
starting worker pid=8516 on localhost:11120 at 11:06:40.616
starting worker pid=8530 on localhost:11120 at 11:06:40.754
starting worker pid=8539 on localhost:11120 at 11:06:40.890
starting worker pid=8548 on localhost:11120 at 11:06:41.026
starting worker pid=8557 on localhost:11120 at 11:06:41.165
starting worker pid=8566 on localhost:11120 at 11:06:41.303
starting worker pid=8575 on localhost:11120 at 11:06:41.443
Executing 7 processes via parallel... 
Starting cross validation with a total of 10 repetitions... 
Performing repetition 1 out of 10... 
Performing cross validation iteration 1 out of 5... 
Computing the initial values of beta by standard NMF... 
Timing stopped at: 0.002 0 0.002
Timing stopped at: 0.001 0 0.001
Timing stopped at: 0 0.001 0.001
Timing stopped at: 0.001 0 0.001
Timing stopped at: 0.001 0 0.001
Timing stopped at: 0.001 0 0.001
Timing stopped at: 0.001 0 0.001
Timing stopped at: 0.001 0 0.001
Error in (function (...)  : All the runs produced an error:
	-#1 [r=3] -> none of the packages are loaded [in call to 'path.package']
	-#2 [r=4] -> none of the packages are loaded [in call to 'path.package']
	-#3 [r=5] -> none of the packages are loaded [in call to 'path.package']
	-#4 [r=6] -> none of the packages are loaded [in call to 'path.package']
	-#5 [r=7] -> none of the packages are loaded [in call to 'path.package']
	-#6 [r=8] -> none of the packages are loaded [in call to 'path.package']
	-#7 [r=9] -> none of the packages are loaded [in call to 'path.package']
	-#8 [r=10] -> none of the packages are loaded [in call to 'path.package']

After loading the full NMF package this is the result:

> cv = nmf.LassoCV(x=patients,K=3:10)
Performing a grid search to estimate the best values of K and lambda with a total of 10 cross validation repetitions... 
starting worker pid=8908 on localhost:11120 at 11:10:08.608
starting worker pid=8917 on localhost:11120 at 11:10:08.744
starting worker pid=8926 on localhost:11120 at 11:10:08.881
starting worker pid=8935 on localhost:11120 at 11:10:09.017
starting worker pid=8944 on localhost:11120 at 11:10:09.155
starting worker pid=8953 on localhost:11120 at 11:10:09.291
starting worker pid=8962 on localhost:11120 at 11:10:09.428
Executing 7 processes via parallel... 
Starting cross validation with a total of 10 repetitions... 
Performing repetition 1 out of 10... 
Performing cross validation iteration 1 out of 5... 
Computing the initial values of beta by standard NMF... 
Error in t.default(curr_beta) : argument is not a matrix
In addition: Warning messages:
1: In .Internal(gc(verbose, reset, full)) :
  closing unused connection 9 (<-localhost:11120)
2: In .Internal(gc(verbose, reset, full)) :
  closing unused connection 8 (<-localhost:11120)
3: In .Internal(gc(verbose, reset, full)) :
  closing unused connection 7 (<-localhost:11120)
4: In .Internal(gc(verbose, reset, full)) :
  closing unused connection 6 (<-localhost:11120)
5: In .Internal(gc(verbose, reset, full)) :
  closing unused connection 5 (<-localhost:11120)
6: In .Internal(gc(verbose, reset, full)) :
  closing unused connection 4 (<-localhost:11120)
7: In .Internal(gc(verbose, reset, full)) :
  closing unused connection 3 (<-localhost:11120)

I'm checking the changelog of NMF to understand if some change was introduced in the output of the function basis which seems to be the responsible of this.

@luca-dex luca-dex added the bug label Sep 20, 2018
@luca-dex
Copy link
Collaborator Author

We're not the first to encounter this error... PoisonAlien/maftools#8

@luca-dex
Copy link
Collaborator Author

The output of this:

curr_beta <- basis(nmf(t(x),rank=K,nrun=nmf_runs))

is NULL

@luca-dex
Copy link
Collaborator Author

Ok, I rewrited the code in this way:

temp_nmf = nmf(t(x),rank=K,nrun=nmf_runs)
curr_beta = basis(temp_nmf)

Now, nmf() is working but the result of this call is not an NMF. As reported in the vignette, when rank is a vector, the result is an object of class NMF.rank that contain all the different object NMF in a list. It is possible to apply the basis function to every object contained in the list but not to the result of the nmf call.

For example, with K = 3:5 I can run this:

temp_nmf = nmf(t(x),rank=K,nrun=nmf_runs)
basis(temp_nmf$fit[['4']])
                           [,1]         [,2]         [,3]         [,4]
M12759_at          2.218067e+03 3.542256e+03 2.872655e-10 7.067707e+04
U46006_s_at        1.461210e+04 5.898066e+02 1.493301e+02 3.914084e+02
X70083_at          6.065541e+02 6.787854e+02 2.159494e+02 5.558119e+02
X03100_cds2_at     1.483671e+05 2.036076e+04 5.522401e+04 5.215328e+04
L32976_at          9.960974e+03 1.547032e+03 3.401427e+03 4.020798e+03
...

danro9685 added a commit that referenced this issue Sep 21, 2018
@luca-dex
Copy link
Collaborator Author

To solve the other issue with the NMF package, the only way I found is to move it to Depends instead of Imports

@ranasats
Copy link

ranasats commented Sep 25, 2018

Another partial-solution for this is to load the NMF package along with everything else.

library("SparseSignatures")
library('NMF')
library("BSgenome.Hsapiens.1000genomes.hs37d5")

#3 was my report on this a little bit ago.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants