"**Objective:** this tool points out the main biological functions used for cancer predictions and quantify their contribution via LRP relevance score. It can be used at three levels: disease, subdisease, and patient.\n",
"\n",
"To be used, the model has to be trained first and saved with the script *DeepGONet.py* (flag ``save=True``).\n",
"Moreover, the package [*innvestigate*](https://github.com/albermax/innvestigate) has to be installed beforehand."
]
},
{
"cell_type":"markdown",
"metadata":{},
"source":[
"#### Load packages"
]
},
{
"cell_type":"code",
"execution_count":1,
"metadata":{},
"outputs":[],
"source":[
"import warnings\n",
"import os"
]
},
{
"cell_type":"code",
"execution_count":2,
"metadata":{},
"outputs":[
{
"name":"stderr",
"output_type":"stream",
"text":[
"/nhome/siniac/vbourgeais/venv/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:523: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.\n",
"/nhome/siniac/vbourgeais/venv/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:524: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.\n",
"/nhome/siniac/vbourgeais/venv/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.\n",
"/nhome/siniac/vbourgeais/venv/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:526: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.\n",
"/nhome/siniac/vbourgeais/venv/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:527: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.\n",
"/nhome/siniac/vbourgeais/venv/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:532: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.\n",
"It has to be executed only once. It means that if the notebook is executed again later, you can skip this step. You can directly jump to the step below."
"Check the real, predicted, and probability class associated to this sample"
]
},
{
"cell_type":"code",
"execution_count":54,
"metadata":{},
"outputs":[
{
"data":{
"text/plain":[
"array([1.], dtype=float32)"
]
},
"execution_count":54,
"metadata":{},
"output_type":"execute_result"
}
],
"source":[
"y_test[idx_sample]"
]
},
{
"cell_type":"code",
"execution_count":55,
"metadata":{},
"outputs":[
{
"data":{
"text/plain":[
"1"
]
},
"execution_count":55,
"metadata":{},
"output_type":"execute_result"
}
],
"source":[
"y_result_final[idx_sample]"
]
},
{
"cell_type":"code",
"execution_count":56,
"metadata":{},
"outputs":[
{
"data":{
"text/plain":[
"array([0.9999999], dtype=float32)"
]
},
"execution_count":56,
"metadata":{},
"output_type":"execute_result"
}
],
"source":[
"y_result[idx_sample]"
]
},
{
"cell_type":"markdown",
"metadata":{},
"source":[
"After our model predicts the outcome of a patient with a probability score, the LRP relevance of each neuron is computed. "
]
},
{
"cell_type":"code",
"execution_count":52,
"metadata":{},
"outputs":[],
"source":[
"analysis = analyzer.analyze(X_test)"
]
},
{
"cell_type":"code",
"execution_count":53,
"metadata":{},
"outputs":[],
"source":[
"LRP_matrix = analyzer._reversed_tensors"
]
},
{
"cell_type":"markdown",
"metadata":{},
"source":[
"#### Interpretation of the prediction "
]
},
{
"cell_type":"markdown",
"metadata":{},
"source":[
"The neurons are sorted according to their relevance score and the most important ones are returned with their corresponding GO term and biological function."