KrishnaswamyLab / MAGIC

MAGIC (Markov Affinity-based Graph Imputation of Cells), is a method for imputing missing values restoring structure of large biological datasets.
GNU General Public License v2.0
341 stars 97 forks source link

Two runs by MAGIC #189

Open GeniusYx opened 4 years ago

GeniusYx commented 4 years ago

Dear authors: Thank you for your contribution.

I have a problem with algorithm robustness. When I use the same dataset and run the algorithm twice to impute the data, can I get the completely same result twice?

Thank you. Look forward to your reply.

scottgigante commented 4 years ago

@GeniusYx the results should be almost identical from run to run -- the only difference is in the computation of randomized PCA. However, to get the same result every time, you can set the seed with random_state.

import numpy as np
import magic

X = np.random.poisson(0.2, (5000, 1000))
X_magic1 = magic.MAGIC(random_state=42).fit_transform(X)
X_magic2 = magic.MAGIC(random_state=42).fit_transform(X)

np.testing.assert_equal(X_magic1, X_magic2)