Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't reproduce my results #77

Open
yunbokai opened this issue Jul 12, 2023 · 3 comments
Open

Can't reproduce my results #77

yunbokai opened this issue Jul 12, 2023 · 3 comments

Comments

@yunbokai
Copy link

Hi,
I use the easy mode to my data with code below:

#Set seed
r_seed=t_seed=n_seed=100
#Search for suitable resolution
#Set seed
random.seed(r_seed)
torch.manual_seed(t_seed)
np.random.seed(n_seed)
#Run SpaGCN
adata.obs["pred"]= spg.detect_spatial_domains_ez_mode(adata, img, x_array, y_array, x_pixel, y_pixel, n_clusters=7, histology=True, s=1, b=49, p=0.5, r_seed=100, t_seed=100, n_seed=100)
adata.obs["pred"]=adata.obs["pred"].astype('category')
#Refine domains (optional)
#shape="hexagon" for Visium data, "square" for ST data.
adata.obs["refined_pred"]=spg.spatial_domains_refinement_ez_mode(sample_id=adata.obs.index.tolist(), pred=adata.obs["pred"].tolist(), x_array=x_array, y_array=y_array, shape="hexagon")
adata.obs["refined_pred"]=adata.obs["refined_pred"].astype('category')

However, each time I ran the same code, I got a similar but different domain result. I want to make the result reproducible. Do you have some advice?

Best wishes,
18k

@jianhuupenn
Copy link
Owner

Thanks for your interest in SpaGCN.
I have tested our method on 3 OS with Intel chips (https://github.com/jianhuupenn/SpaGCN#versions-the-software-has-been-tested-on), and setting the same seed will generate exactly the same results. I suspect that your issue results from the hardware. Are you using a machine with M1/2 chip?

@yunbokai
Copy link
Author

Thanks for your quick reply!
I use 20.04.1-Ubuntu and Anaconda whith python==3.9, because lower version was difficult to install. I got SpaGCN version 1.2.7. Here is my env version:

# packages in environment at /home/data/ybk/.conda/envs/SpaGCN:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                        main    defaults
_openmp_mutex             5.1                       1_gnu    defaults
anndata                   0.9.1                    pypi_0    pypi
asttokens                 2.0.5              pyhd3eb1b0_0    defaults
backcall                  0.2.0              pyhd3eb1b0_0    defaults
ca-certificates           2023.05.30           h06a4308_0    defaults
certifi                   2022.12.7                pypi_0    pypi
charset-normalizer        2.1.1                    pypi_0    pypi
comm                      0.1.2            py39h06a4308_0    defaults
contourpy                 1.1.0                    pypi_0    pypi
cycler                    0.11.0                   pypi_0    pypi
debugpy                   1.5.1            py39h295c915_0    defaults
decorator                 5.1.1              pyhd3eb1b0_0    defaults
executing                 0.8.3              pyhd3eb1b0_0    defaults
filelock                  3.9.0                    pypi_0    pypi
fonttools                 4.40.0                   pypi_0    pypi
h5py                      3.9.0                    pypi_0    pypi
idna                      3.4                      pypi_0    pypi
igraph                    0.10.5                   pypi_0    pypi
importlib-metadata        6.0.0            py39h06a4308_0    defaults
importlib-resources       6.0.0                    pypi_0    pypi
importlib_metadata        6.0.0                hd3eb1b0_0    defaults
ipykernel                 6.19.2           py39hb070fc8_0    defaults
ipython                   8.12.0           py39h06a4308_0    defaults
jedi                      0.18.1           py39h06a4308_1    defaults
jinja2                    3.1.2                    pypi_0    pypi
joblib                    1.3.1                    pypi_0    pypi
jupyter_client            8.1.0            py39h06a4308_0    defaults
jupyter_core              5.3.0            py39h06a4308_0    defaults
kiwisolver                1.4.4                    pypi_0    pypi
ld_impl_linux-64          2.38                 h1181459_1    defaults
libffi                    3.4.4                h6a678d5_0    defaults
libgcc-ng                 11.2.0               h1234567_1    defaults
libgomp                   11.2.0               h1234567_1    defaults
libsodium                 1.0.18               h7b6447c_0    defaults
libstdcxx-ng              11.2.0               h1234567_1    defaults
llvmlite                  0.40.1                   pypi_0    pypi
louvain                   0.8.0                    pypi_0    pypi
markupsafe                2.1.2                    pypi_0    pypi
matplotlib                3.7.2                    pypi_0    pypi
matplotlib-inline         0.1.6            py39h06a4308_0    defaults
mpmath                    1.2.1                    pypi_0    pypi
natsort                   8.4.0                    pypi_0    pypi
ncurses                   6.4                  h6a678d5_0    defaults
nest-asyncio              1.5.6            py39h06a4308_0    defaults
networkx                  3.0                      pypi_0    pypi
numba                     0.57.1                   pypi_0    pypi
numpy                     1.24.0                   pypi_0    pypi
opencv-python             4.8.0.74                 pypi_0    pypi
openssl                   3.0.9                h7f8727e_0    defaults
packaging                 23.1                     pypi_0    pypi
pandas                    2.0.3                    pypi_0    pypi
parso                     0.8.3              pyhd3eb1b0_0    defaults
patsy                     0.5.3                    pypi_0    pypi
pexpect                   4.8.0              pyhd3eb1b0_3    defaults
pickleshare               0.7.5           pyhd3eb1b0_1003    defaults
pillow                    9.3.0                    pypi_0    pypi
pip                       23.1.2           py39h06a4308_0    defaults
platformdirs              2.5.2            py39h06a4308_0    defaults
prompt-toolkit            3.0.36           py39h06a4308_0    defaults
psutil                    5.9.0            py39h5eee18b_0    defaults
ptyprocess                0.7.0              pyhd3eb1b0_2    defaults
pure_eval                 0.2.2              pyhd3eb1b0_0    defaults
pygments                  2.15.1           py39h06a4308_1    defaults
pynndescent               0.5.10                   pypi_0    pypi
pyparsing                 3.0.9                    pypi_0    pypi
python                    3.9.17               h955ad1f_0    defaults
python-dateutil           2.8.2              pyhd3eb1b0_0    defaults
python-igraph             0.10.5                   pypi_0    pypi
pytz                      2023.3                   pypi_0    pypi
pyzmq                     25.1.0           py39h6a678d5_0    defaults
readline                  8.2                  h5eee18b_0    defaults
requests                  2.28.1                   pypi_0    pypi
scanpy                    1.9.3                    pypi_0    pypi
scikit-learn              1.3.0                    pypi_0    pypi
scipy                     1.11.1                   pypi_0    pypi
seaborn                   0.12.2                   pypi_0    pypi
session-info              1.0.0                    pypi_0    pypi
setuptools                67.8.0           py39h06a4308_0    defaults
six                       1.16.0             pyhd3eb1b0_1    defaults
sqlite                    3.41.2               h5eee18b_0    defaults
stack_data                0.2.0              pyhd3eb1b0_0    defaults
statsmodels               0.14.0                   pypi_0    pypi
stdlib-list               0.9.0                    pypi_0    pypi
sympy                     1.11.1                   pypi_0    pypi
texttable                 1.6.7                    pypi_0    pypi
threadpoolctl             3.1.0                    pypi_0    pypi
tk                        8.6.12               h1ccaba5_0    defaults
torch                     2.0.1+cpu                pypi_0    pypi
torchaudio                2.0.2+cpu                pypi_0    pypi
torchvision               0.15.2+cpu               pypi_0    pypi
tornado                   6.2              py39h5eee18b_0    defaults
tqdm                      4.65.0                   pypi_0    pypi
traitlets                 5.7.1            py39h06a4308_0    defaults
typing-extensions         4.4.0                    pypi_0    pypi
typing_extensions         4.6.3            py39h06a4308_0    defaults
tzdata                    2023.3                   pypi_0    pypi
umap-learn                0.5.3                    pypi_0    pypi
urllib3                   1.26.13                  pypi_0    pypi
wcwidth                   0.2.5              pyhd3eb1b0_0    defaults
wheel                     0.38.4           py39h06a4308_0    defaults
xz                        5.4.2                h5eee18b_0    defaults
zeromq                    4.3.4                h2531618_0    defaults
zipp                      3.16.0                   pypi_0    pypi
zlib                      1.2.13               h5eee18b_0    defaults

Do you think I must use the env you offered ? thanks.

@WJPina
Copy link

WJPina commented Apr 17, 2024

I got the same issue, did you find the solution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants