|
a |
|
b/dnn_predicts/README.md |
|
|
1 |
# Model predictions on the test set |
|
|
2 |
This folder contain the deep neural network predictions on the test set. All files are in |
|
|
3 |
the format `.npy` and can be read using `numpy.load()`. Each one should contain a |
|
|
4 |
|
|
|
5 |
All the content within this folder can be generate using the following sequence of commands: |
|
|
6 |
|
|
|
7 |
(without a GPU it should take about 25 minutes. With GPU acceleration it should take |
|
|
8 |
less then one minute) |
|
|
9 |
|
|
|
10 |
```bash |
|
|
11 |
cd /path/to/automatic-ecg-diagnosis |
|
|
12 |
PFOLDER="./dnn_predicts" |
|
|
13 |
MFOLDER="./model" |
|
|
14 |
DFOLDER="./data" |
|
|
15 |
|
|
|
16 |
# To generate the predictions on the test set corresponding to the main model used allong the paper use: |
|
|
17 |
|
|
|
18 |
python predict.py $DFOLDER/ecg_tracings.hdf5 $MFOLDER/model.hdf5 --output_file $PFOLDER/model.npy |
|
|
19 |
|
|
|
20 |
|
|
|
21 |
# We also train several networks with the same architecture and configuration |
|
|
22 |
# but with different initial seeds. In order to generate the neural network |
|
|
23 |
# prediction on the test set for each of these models: |
|
|
24 |
|
|
|
25 |
mkdir $FNAME/other_seeds |
|
|
26 |
for n in 1 2 3 4 5 6 7 8 9 10 |
|
|
27 |
do |
|
|
28 |
python predict.py $DFOLDER/ecg_tracings.hdf5 $MFOLDER/other_seeds/model_$n.hdf5 --output_file $PFOLDER/other_seeds/model_$n.npy |
|
|
29 |
done |
|
|
30 |
|
|
|
31 |
|
|
|
32 |
# Finally, to asses the effect of how we structure our problem, we have considered alternative s |
|
|
33 |
# cenarios where we use 90\%-5\%-5\% splits, stratified randomly, |
|
|
34 |
# by patient or in chronological order. The predictions of those models in the test set |
|
|
35 |
# can be obtained using: |
|
|
36 |
|
|
|
37 |
mkdir $PFOLDER/other_splits |
|
|
38 |
for n in date_order individual_patients normal_order |
|
|
39 |
do |
|
|
40 |
python predict.py $DFOLDER/ecg_tracings.hdf5 $MFOLDER/other_splits/model_$n.hdf5 --output_file $PFOLDER/other_splits/model_$n.npy |
|
|
41 |
done |
|
|
42 |
``` |
|
|
43 |
|
|
|
44 |
Where the `DFOLDER` should give the path to the folder containing the test dataset and `MFOLDER` should point to the |
|
|
45 |
folder containing pre-trained models. The test dataset can be downloaded from [here](https://doi.org/10.5281/zenodo.3625006) and the |
|
|
46 |
pretrained models can be downloaded from here [here](https://doi.org/10.5281/zenodo.3625017) |