shenwanxiang / bidd-aggmap

Jigsaw-like AggMap: A Robust and Explainable Multi-Channel Omics Deep Learning Tool
https://bidd-aggmap.readthedocs.io/en/latest/
GNU General Public License v3.0
34 stars 5 forks source link

Error when running 01_mnist_data.ipynb #9

Closed dxbdxx closed 2 years ago

dxbdxx commented 2 years ago

When I run the script _01_mnistdata.ipynb in the folder paper, I get the following error

File "bidd-aggmap-master\paper\00_mnist\correlation\aggmap\utils\calculator.py", line 23, in _calculate
    x1 = data[:, i1]
NameError: name 'data' is not defined

NameError                                 
Traceback (most recent call last)
<ipython-input-10-b1aa715419d2> in <module>
----> 1 mp_train = AggMap(x_train_df, metric = metric)
      2 mp_test = AggMap(x_test_df, metric = metric)
      3 
      4 mp_train.save(os.path.join(data_save_folder, 'train.mp'))
      5 mp_test.save(os.path.join(data_save_folder, 'test.mp'))

I just copy the aggmap folder into the working directory and modified the _mnist_data_savefolder in config.py. Could you please explain the error so that I can modify it myself? Thanks.

shenwanxiang commented 2 years ago

When I run the script _01_mnistdata.ipynb in the folder paper, I get the following error

File "bidd-aggmap-master\paper\00_mnist\correlation\aggmap\utils\calculator.py", line 23, in _calculate
    x1 = data[:, i1]
NameError: name 'data' is not defined

NameError                                 
Traceback (most recent call last)
<ipython-input-10-b1aa715419d2> in <module>
----> 1 mp_train = AggMap(x_train_df, metric = metric)
      2 mp_test = AggMap(x_test_df, metric = metric)
      3 
      4 mp_train.save(os.path.join(data_save_folder, 'train.mp'))
      5 mp_test.save(os.path.join(data_save_folder, 'test.mp'))

I just copy the aggmap folder into the working directory and modified the _mnist_data_savefolder in config.py. Could you please explain the error so that I can modify it myself? Thanks.

Hi, May I know your python version? try to add this before you import aggmap:

import sys
sys.path.insert(0, 'Your_aggmap_path/')
dxbdxx commented 2 years ago

Thank you for your reply. I'm using Python 3.7.6 and adding the path doesn't work. I think the error is related to the statement global data in calculator.py. Finally, I set by_scipy = True in AggMap and it works fine.