CityUHK-CompBio / DeepCC

DeepCC: a novel deep learning-based framework for cancer molecular subtype classification
https://CityUHK-CompBio.github.io/DeepCC/
MIT License
20 stars 16 forks source link

报错:Error in mx.opt.sgd(...) : unused argument (device = device) #1

Closed zhaoliang0302 closed 4 years ago

zhaoliang0302 commented 4 years ago

您好,在运行代码时报错 deepcc.model <- trainDeepCCModel(fs, labels) Error in mx.opt.sgd(...) : unused argument (device = device) google下尝试了这行代码没明白什么意思 device = mx.cpu() $device [1] "cpu"

$device_id [1] 0

$device_typeid [1] 1

attr(,"class") [1] "MXContext"

我是想把TCGA的gene表达矩阵根据公认的分子分型来预测我自己样本的分型,labels是每个样本的所对应的分型类型吗? 还有,TCGA的矩阵是microarray的还是RNAseq的比较好?如果的是RNAseq的话是用count还是tpm、fpkm好呢? 谢谢

gaofeng21cn commented 4 years ago

简单回答一下。 我个人推测错误代码是MXNET产生的,MXNET改变了接口,所以DeepCC对应的调用就出错了,你可以尝试使用DeepCC开发的时候用的MXNET版本,大约是0.10.0

另外,因为MXNET对于R不是很友好,现在的测试版本讲后端改成了keras,可以安装DeepCC对应的keras分支,但是这个版本DeepCC本身的函数明明风格有变化,正式发布之前请自行查看对应的函数名。

zhaoliang0302 commented 4 years ago

用了DeepCC@keras之后 deepcc.model <- train_DeepCC_model(fs, labels) Error in train_DeepCC_model(fs, labels, epochs = 100, dropout = 0.5, activation_func = "selu") : object 'y_train' not found 不知道y_train是什么

zhaoliang0302 commented 4 years ago

DeepCC@keras这一版有没有简单的函数介绍,里面很多变量不知道什么意思,MXNET的旧版本找不到,现在无法进行下去了, 谢谢

gaofeng21cn commented 4 years ago

keras后端的版本还在测试,没有完全定型,正式发布前会完善帮助文档。 mxnet的版本变更不是我们能控制的,在旧版本上使用是没有问题的,我们不准备兼容新版的mxnet,会一次性切换到keras。

zhaoliang0302 commented 4 years ago

能否提供个可用的mxnet包文件,我找了很久没找到,麻烦你了

gaofeng21cn commented 4 years ago

mxnet包可以装cran的版本,所有cran包在GitHub上都有镜像,可以随便选择版本。但mxnet应该还需要单独的library。

zhaoliang0302 commented 4 years ago

https://github.com/apache/incubator-mxnet/tree/v0.10.0-support/R-package 我找到了这个,文件夹形式不知道怎么装进r里去 但mxnet应该还需要单独的library这一句我不太懂怎么操作 我尝试把整个项目文件下载下来,里面的r-package文件拉出来压缩成tar.gz文件,再用r本地安装,出现报错:

ERROR: a 'NAMESPACE' file is required
* removing 'C:/Users/Documents/R/win-library/3.6/mxnet'
Warning message:
In install.packages("C:/Users/Desktop/R-package.tar.gz",  :
  installation of package ‘C:/Users/Desktop/R-package.tar.gz’ had non-zero exit status
zhaoliang0302 commented 4 years ago

使用keras分支,出现报错,python3.8 64bit我已经安装了,操作系统win8.1 64bit

deepcc.model <- train_DeepCC_model(fs, labels)
Error in py_initialize(config$python, config$libpython, config$pythonhome,  : 
  Py_CompileString - 找不到指定的程序。
gaofeng21cn commented 4 years ago

你好,你现在的报错信息都是来自于依赖关系,不涉及到DeepCC本身。 1.请确定你R中的keras本身可以正常使用,我们建议使用conda安装。Windows 8.1是很古老的版本,我们不会去测试。我自己的开发环境是Debian 10和macOS 10.15,都没有问题。 2.mxnet的安装比你想的复杂,这也是我们抛弃的原因。和keras一样,mxnet的R包仅仅是一个接口,你需要对应的二进制程序,接口才能使用。但我记得旧版本的mxnet在cran上安装,虽然只支持cpu,它会自动从aws上下载对应的二进制库。cran上是可以安装旧版本的包,你可以尝试。https://codeday.me/bug/20170703/33041.html

zhaoliang0302 commented 4 years ago

谢谢,都尝试了实在搞不定放弃了,mxnet的找不到,包安装太复杂了,不知道能不能等到DeepCC能像常见r包简单安装的那时候

gaofeng21cn commented 4 years ago

所以我们有一个网站的版本直接给大家用,源代码的版本更多的是学习目的。DeepCC还是要依赖于一种深度学习的框架,这点是没法简化掉的,DeepCC只是深度学习在分子分型问题上的一个扩展。

MolecularPathologyLab commented 4 years ago

Hello, I get this error when running the code deepcc.model <- trainDeepCCModel(fs, labels)

Error in mx.opt.sgd (...): unused argument (device = device)

I googled and tried a lot but couldn't solve it. I want to run your model on mouse data and compare its performance with another. Could you please help me?

Another question: How I can get the final features that the model used to predict the CMS subtypes in the DeepCC online?

Thanks!

gaofeng21cn commented 4 years ago

Hi,

I checked the error message and I think it is caused by mxnet. They changed the parameter name inside their function from 'device' to 'ctx'.

Since we are in the middle of changing the deep learning backend from mxnet to keras, which has official support from RStudio, we don't have test environment to re-test the new change made by mxnet. But I made a temporary patch for it. If that is the only problem here, you can fix it by installing the latest version of DeepCC from GitHub.

MolecularPathologyLab commented 4 years ago

Thank you for your reply. I installed it 2 weeks ago. Should I reinstall it?

Is it possible to get the final features that the model used to predict the CMS subtypes in the DeepCC online?

gaofeng21cn commented 4 years ago

Yes, you should do it again. I updated the repo about 20 hours ago. I guess it will fix the problem but I didn’t test it. Anyway we will release a new version soon with keras supporting.

There is a function in the DeepCC which help you do this, getDeepCCFeatures. Please check the help.

MolecularPathologyLab commented 4 years ago

I reinstall it using : devtools::install_github("CityUHK-CompBio/DeepCC") now after running this fs <- getFunctionalSpectra(eps, genSets_mus) I gets this error

Error in { : 
  task 1 failed - "lazy-load database '/home/raheleh/R/x86_64-pc-linux-gnu-library/3.6/DeepCC/R/DeepCC.rdb' is corrupt"
In addition: Warning messages:
1: In if (geneSets == "MSigDBv5") { :
  the condition has length > 1 and only the first element will be used
2: In if (geneSets == "MSigDBv6") { :
  the condition has length > 1 and only the first element will be used

However, it return me the fs.


Still, the previous error has been remained after running
 `deepcc.model <- trainDeepCCModel(fs, lab)`
`Error in mx.opt.sgd(...) : unused argument (device = device)`
MolecularPathologyLab commented 4 years ago

Hi Gaofeng21cn, After you updating DeepCC and I reinstalled it, I am getting error after running this code: fs <- getFunctionalSpectra(eps, genSets_mus)

Error in { : 
  task 1 failed - "lazy-load database '/home/raheleh/R/x86_64-pc-linux-gnu-library/3.6/DeepCC/R/DeepCC.rdb' is corrupt"
In addition: Warning messages:
1: In if (geneSets == "MSigDBv5") { :
  the condition has length > 1 and only the first element will be used
2: In if (geneSets == "MSigDBv6") { :
  the condition has length > 1 and only the first element will be used

In your online version of DeepCC, is it possible to download the features that has been used to predict the CMS subtypes in our samples? Many thanks for your time and help!

gaofeng21cn commented 4 years ago

Hi Rahil63,

From my experience, something like ".rdb is corrupt" usually can be fixed by restarting the R session. Warning messages don't matter I saw the same thing on my test machine (a Windows PC) but it works.

The online version of DeepCC only gives the results and probability.

gaofeng21cn commented 4 years ago

您好,在运行代码时报错 deepcc.model <- trainDeepCCModel(fs, labels) Error in mx.opt.sgd(...) : unused argument (device = device) google下尝试了这行代码没明白什么意思 device = mx.cpu() $device [1] "cpu"

$device_id [1] 0

$device_typeid [1] 1

attr(,"class") [1] "MXContext"

我是想把TCGA的gene表达矩阵根据公认的分子分型来预测我自己样本的分型,labels是每个样本的所对应的分型类型吗? 还有,TCGA的矩阵是microarray的还是RNAseq的比较好?如果的是RNAseq的话是用count还是tpm、fpkm好呢? 谢谢

对mxnet版本进行补充说明。 因为keras版本我们还在优化中,所以快速修复了一下mxnet版本不兼容的问题。主要是在新版的mxnet,指定计算设备是cpu还是gpu的参数改名叫做ctx。另外我检查了一下现在mxnet的安装方法,如果不要求gpu支持的话,3.5.x版本的R在macOS和Windows下可以直接装预编译版本的mxnet,相对简单很多,应该可以解决使用的问题。

参考:https://mxnet.apache.org/get_started?platform=windows&language=r&processor=cpu&

MolecularPathologyLab commented 4 years ago

Hi Gaofeng21cn, My data is RNAseq that are normalized using DESeq2 and log2 transformed. In the example that you provided in the home page of online DeepCC (a small dataset), there are aslo negative values. I am wondering that should I do any scaling before uploading my data for DeepCC analysis?

gaofeng21cn commented 4 years ago

No scaling or normalization is needed for DeepCC.

Best regards, Feng GAO, Ph.D., Associate Professor The Sixth Affiliated Hospital, Sun Yat-sen University Guangzhou, China 在 2020年5月31日 +0800 14:10,MolecularPatholgyLab notifications@github.com,写道: Hi Gaofeng21cn, My data is RNAseq that are normalized using DESeq2 and log2 transformed. In the example that you provided in the home page of online DeepCC (a small dataset), there are aslo negative values. I am wondering that should I do any scaling before uploading my data for DeepCC analysis? — You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or unsubscribe.

MolecularPathologyLab commented 4 years ago

Thanks for quick reply! Then, why there are some negative values in your example? My data was read count and I used DESeq2 to covert it to expression value and then transformed it to log2 format. Can I upload this to the DeepCC?

gaofeng21cn commented 4 years ago

Sure, just keep the format of the file right.

The format of values is not important since functional spectra used in deep learning model were calculated in a rank-based manner. The negative values in our example are simply caused by the normalization method which doesn’t matter for DeepCC.

Best regards, Feng GAO, Ph.D., Associate Professor The Sixth Affiliated Hospital, Sun Yat-sen University Guangzhou, China 在 2020年5月31日 +0800 14:30,MolecularPatholgyLab notifications@github.com,写道: Thanks for quick reply! Then, why there are some negative values in your example? My data was read count and I used DESeq2 to covert it to expression value and then transformed it to log2 format. Can I upload this to the DeepCC? — You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or unsubscribe.

MolecularPathologyLab commented 3 years ago

Hi Gaofeng,

I used getDeepCCFeatures function to get the features that are using at the end to call CMS in your model, it returns me a matrix of 80*10 without any names. Is it possible to get the name of gene sets that are using as best features to call CMS subtype? Many thanks, Raheleh

gaofeng21cn commented 3 years ago

Hi Raheleh,

This function is designed to transform data to feature and what I think you want is select feature. It is different since concept of deep learning.

Best regards, Feng GAO, Ph.D., Associate Professor The Sixth Affiliated Hospital, Sun Yat-sen University Guangzhou, China FengGaoLab.org

        2021年4月16日 +0800 21:07 MolecularPatholgyLab ***@***.***>,写道:

Hi Gaofeng, I used getDeepCCFeatures function to get the features that are using at the end to call CMS in your model, it returns me a matrix of 80*10 without any names. Is it possible to get the name of gene sets that are using as best features to call CMS subtype? Many thanks, Raheleh — You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or unsubscribe.