Skip to content

Issues running example code in Docker container #38

@cwzhou

Description

@cwzhou

Hello. Thank you for providing your code and detailed descriptions of how to run. This is helpful as I begin to explore various Deep Learning methods. I was trying to run the example code through the Docker container (which defaults to the Brain_Integ.mat sample data) but ran into a few issues, which worked after some debugging. It appears that the example code on the GitHub page is different from the code in Docker. Quite a few errors that resulted were solved after realizing this and copying the GitHub codes into Docker and running those instead. Below is what I did to attempt to resolve the issues.

SurvivalNet Process/Debug:

First, enter Docker.

docker pull cancerdatascience/snet:version1
docker run -it cancerdatascience/snet:version1 /bin/bash
cd SurvivalNet/examples
python Run.py (obtain an Error about './data/Brain_Integ.mat')

Edit the following python scripts: Run.py: change line 133 to "../data/Brain_Integ.mat":
parser.add_argument('-ip', '--input_path', dest='input_path',
default='../data/Brain_Integ.mat',
help='Path specifying location of dataset.')

Re-run:
python Run.py
python ModelAnalysis.py

Modify ModelAnalysis.py to fix the following errors (fix one then re-run to obtain the next):

Error about 'NameError: name 'scipy' is not defined'': change line 15 from "X = scipy.io.loadmat(Data[i])" to:
# Loads normalized data.
X = sio.loadmat(Data[i])

Error about 'No such file or directory: 'i../data/Brain_Integ.mat'': change line 9 to:
Data = ['../data/Brain_Integ.mat']

Error about 'No such file or directory: '../models/nl1-hs10-dor0.62-id0final_model'': change line 7-8 to:
ModelPaths = ['results/']
Models = ['final_model']

We compared the script within the Docker to the GitHub repo script and found that this error was not made in the GitHub -- only the Docker container!

Re-run.

We obtain an error when running ModelAnalysis for no "results/final_model" path -- We compared the script within the Docker to the GitHub repo script and found that the GitHub repo script was different than within the Docker image.
We re-wrote Run2.py which contained the GitHub version of Run.py (BUT STILL making the same correction regarding ../data/Brain_Integ.mat) and the code ran.

python Run2.py

We re-run ModelAnalysis.py but this time we note there are also discrepancies between GitHub Repo and Docker container file (since we get an error saying "Nbox" and there is no Nbox for GitHub even though there is for Docker image file). We create ModelAnalysis2.py by copying the GitHub repo version (maintaining the same changes we made previously for ModelAnalysis.py within Docker since those errors are the same).

python ModelAnalysis2.py

Obtain error: "TypeError: Cannot convert Type TensorType(float64, matrix) (of Variable X) into Type TensorType(float32, matrix). You can try to manually convert X into a TensorType(float32, matrix)."

NOTE: IN ORDER TO DEBUG AND EDIT SCRIPTS, we need to edit the scripts here to edit the survivalnet package (NOT in the SurvivalNet/analysis folder!): "/usr/local/lib/python2.7/dist-packages/survivalnet-0.1.0-py2.7.egg/survivalnet/analysis/"

Edit RiskCohort.py so that line 28 X is float32 (such that theano.function will run):
# define partial derivative
X = T.matrix('X', dtype='float32')

To avoid error of 'Unique' not being defined before used, edit Visualization.py (go to KMPlots definition) to move 'Unique' outside of (i.e., before) "if Types[i] == ''" statements:
# get unique values to determine if binary or continuous
Unique = np.unique(Raw[:, i])

-- done with debugging. Now example code will run (Run.py and ModelAnalysis.py)

Command line warnings (see screenshot):
root@e816d5997cd4:/SurvivalNet/examples# python ModelAnalysis2.py

Generting risk gradient profiles...
Generating risk gradient boxplot...
/usr/local/lib/python2.7/dist-packages/survivalnet-0.1.0-py2.7.egg/survivalnet/analysis/Visualization.py:157: MatplotlibDeprecationWarning: The set_axis_bgcolor function was deprecated in version 2.0. Use set_facecolor instead.
Axes.set_axis_bgcolor('white')
Generating paired scatter gradient plots...
Generating paired scatter feature plots...
/usr/local/lib/python2.7/dist-packages/numpy/lib/function_base.py:4011: RuntimeWarning: Invalid value encountered in median
r = func(a, **kwargs)
Generating cluster analysis...
/usr/local/lib/python2.7/dist-packages/survivalnet-0.1.0-py2.7.egg/survivalnet/analysis/RiskCluster.py:88: ClusterWarning: scipy.cluster: The symmetric non-negative hollow observation matrix looks suspiciously like an uncondensed distance matrix
metric='correlation')
/usr/local/lib/python2.7/dist-packages/survivalnet-0.1.0-py2.7.egg/survivalnet/analysis/RiskCluster.py:96: ClusterWarning: scipy.cluster: The symmetric non-negative hollow observation matrix looks suspiciously like an uncondensed distance matrix
metric='correlation')
Generating Kaplan-Meier plots...
Saving figures...


I wanted to check, are these Warnings expected for a default run of the example code with the sample data provided?

Thank you for your time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions