bioFAM / MOFA2

Multi-Omics Factor Analysis
https://biofam.github.io/MOFA2/
GNU Lesser General Public License v3.0
283 stars 49 forks source link

run_mofa stuck on iteration 49. optimising sigma node #131

Closed GabriellaS-K closed 10 months ago

GabriellaS-K commented 10 months ago

Hi! I'm very new to this so I'm sure I'm missing a lot. I'm trying to run_mofa on my MOFAobject_untrained.

Each time this happens, it gets stuck:

Iteration 47: time=0.01, Factors=2
Iteration 48: time=0.01, Factors=2
Iteration 49: time=0.01, Factors=2
Optimising sigma node...

and eventually r aborts. There are some NAs in my dataset, could this be a problem? What can I do to start troubleshooting and understanding what is going wrong?

Thanks!

cyrusmallon commented 9 months ago

was there an actually problem or did it just take a long time to complete?

alienzj commented 3 months ago

Same issue I meet when I run the example code from "https://biofam.github.io/MOFA2/MEFISTO.html"

alienzj commented 3 months ago

image image

cyrusmallon commented 3 months ago

7 days is way too long. I would say it has to do with there possibly not being enough variation in your data. Did you get any warnings from MOFA/MEFISTO before it started performing iterations? Make sure to regress out high cocorrelated features. Also look at the distribution of your features to see if they are comparable. Some normalization may be required.

alienzj commented 3 months ago

It's not real 7 days. It's CPU time. R session is running using 64 threads. Here is the output from R console:

Connecting to the mofapy2 package using basilisk. 
    Set 'use_basilisk' to FALSE if you prefer to manually set the python binary using 'reticulate'.

        #########################################################
        ###           __  __  ____  ______                    ### 
        ###          |  \/  |/ __ \|  ____/\    _             ### 
        ###          | \  / | |  | | |__ /  \ _| |_           ### 
        ###          | |\/| | |  | |  __/ /\ \_   _|          ###
        ###          | |  | | |__| | | / ____ \|_|            ###
        ###          |_|  |_|\____/|_|/_/    \_\              ###
        ###                                                   ### 
        ######################################################### 

use_float32 set to True: replacing float64 arrays by float32 arrays to speed up computations...

Successfully loaded view='microbiome' group='C001' with N=24 samples and D=969 features...
Successfully loaded view='microbiome' group='C002' with N=24 samples and D=969 features...
Successfully loaded view='microbiome' group='C004' with N=24 samples and D=969 features...
Successfully loaded view='microbiome' group='C005' with N=24 samples and D=969 features...
Successfully loaded view='microbiome' group='C007' with N=24 samples and D=969 features...
Successfully loaded view='microbiome' group='C008' with N=24 samples and D=969 features...
Successfully loaded view='microbiome' group='C009' with N=24 samples and D=969 features...
Successfully loaded view='microbiome' group='C010' with N=24 samples and D=969 features...
Successfully loaded view='microbiome' group='C011' with N=24 samples and D=969 features...
Successfully loaded view='microbiome' group='C012' with N=24 samples and D=969 features...
Successfully loaded view='microbiome' group='C014' with N=24 samples and D=969 features...
Successfully loaded view='microbiome' group='C016' with N=24 samples and D=969 features...
Successfully loaded view='microbiome' group='C017' with N=24 samples and D=969 features...
Successfully loaded view='microbiome' group='C018' with N=24 samples and D=969 features...
Successfully loaded view='microbiome' group='C020' with N=24 samples and D=969 features...
Successfully loaded view='microbiome' group='C021' with N=24 samples and D=969 features...
Successfully loaded view='microbiome' group='C022' with N=24 samples and D=969 features...
Successfully loaded view='microbiome' group='C023' with N=24 samples and D=969 features...
Successfully loaded view='microbiome' group='C024' with N=24 samples and D=969 features...
Successfully loaded view='microbiome' group='C025' with N=24 samples and D=969 features...
Successfully loaded view='microbiome' group='C027' with N=24 samples and D=969 features...
Successfully loaded view='microbiome' group='C030' with N=24 samples and D=969 features...
Successfully loaded view='microbiome' group='C031' with N=24 samples and D=969 features...
Successfully loaded view='microbiome' group='C032' with N=24 samples and D=969 features...
Successfully loaded view='microbiome' group='C033' with N=24 samples and D=969 features...
Successfully loaded view='microbiome' group='C034' with N=24 samples and D=969 features...
Successfully loaded view='microbiome' group='C035' with N=24 samples and D=969 features...
Successfully loaded view='microbiome' group='C036' with N=24 samples and D=969 features...
Successfully loaded view='microbiome' group='C037' with N=24 samples and D=969 features...
Successfully loaded view='microbiome' group='C038' with N=24 samples and D=969 features...
Successfully loaded view='microbiome' group='C041' with N=24 samples and D=969 features...
Successfully loaded view='microbiome' group='C042' with N=24 samples and D=969 features...
Successfully loaded view='microbiome' group='C043' with N=24 samples and D=969 features...
Successfully loaded view='microbiome' group='C044' with N=24 samples and D=969 features...
Successfully loaded view='microbiome' group='C045' with N=24 samples and D=969 features...
Successfully loaded view='microbiome' group='C046' with N=24 samples and D=969 features...
Successfully loaded view='microbiome' group='C047' with N=24 samples and D=969 features...
Successfully loaded view='microbiome' group='C049' with N=24 samples and D=969 features...
Successfully loaded view='microbiome' group='C052' with N=24 samples and D=969 features...
Successfully loaded view='microbiome' group='C053' with N=24 samples and D=969 features...
Successfully loaded view='microbiome' group='C055' with N=24 samples and D=969 features...
Successfully loaded view='microbiome' group='C056' with N=24 samples and D=969 features...
Successfully loaded view='microbiome' group='C057' with N=24 samples and D=969 features...

Loaded 1 covariate(s) for each sample...

Model options:
- Automatic Relevance Determination prior on the factors: True
- Automatic Relevance Determination prior on the weights: True
- Spike-and-slab prior on the factors: False
- Spike-and-slab prior on the weights: False
Likelihoods:
- View 0 (microbiome): gaussian

Smooth covariate framework is activated. This is not compatible with ARD prior on factors. Setting ard_factors to False...

######################################
## Training the model with seed 2020 ##
######################################

ELBO before training: -356204.65 

Iteration 1: time=3.31, ELBO=-125045.52, deltaELBO=231159.125 (64.89503322%), Factors=2
Iteration 2: time=1.85, Factors=2
Iteration 3: time=1.87, Factors=2
Iteration 4: time=1.91, Factors=2
Iteration 5: time=1.86, Factors=2
Iteration 6: time=3.30, ELBO=-121007.19, deltaELBO=4038.332 (1.13371115%), Factors=2
Iteration 7: time=1.84, Factors=2
Iteration 8: time=1.89, Factors=2
Iteration 9: time=1.86, Factors=2
Iteration 10: time=1.85, Factors=2
Iteration 11: time=3.32, ELBO=-120726.73, deltaELBO=280.464 (0.07873662%), Factors=2
Iteration 12: time=1.83, Factors=2
Iteration 13: time=1.85, Factors=2
Iteration 14: time=1.87, Factors=2
Iteration 15: time=1.80, Factors=2
Iteration 16: time=3.28, ELBO=-120623.09, deltaELBO=103.634 (0.02909390%), Factors=2
Iteration 17: time=1.82, Factors=2
Iteration 18: time=1.83, Factors=2
Iteration 19: time=1.80, Factors=2
Iteration 20: time=1.80, Factors=2
Iteration 21: time=3.33, ELBO=-120563.95, deltaELBO=59.148 (0.01660520%), Factors=2
Iteration 22: time=1.85, Factors=2
Iteration 23: time=1.84, Factors=2
Iteration 24: time=1.84, Factors=2
Iteration 25: time=1.83, Factors=2
Iteration 26: time=3.24, ELBO=-120528.40, deltaELBO=35.550 (0.00998032%), Factors=2
Iteration 27: time=1.83, Factors=2
Iteration 28: time=1.79, Factors=2
Iteration 29: time=1.83, Factors=2
Iteration 30: time=1.80, Factors=2
Iteration 31: time=3.30, ELBO=-120508.39, deltaELBO=20.003 (0.00561565%), Factors=2
Iteration 32: time=1.82, Factors=2
Iteration 33: time=1.78, Factors=2
Iteration 34: time=1.87, Factors=2
Iteration 35: time=1.87, Factors=2
Iteration 36: time=3.31, ELBO=-120483.58, deltaELBO=24.816 (0.00696681%), Factors=2
Iteration 37: time=1.85, Factors=2
Iteration 38: time=1.92, Factors=2
Iteration 39: time=1.88, Factors=2
Iteration 40: time=1.83, Factors=2
Iteration 41: time=3.29, ELBO=-120474.71, deltaELBO=8.868 (0.00248970%), Factors=2
Iteration 42: time=1.86, Factors=2
Iteration 43: time=1.81, Factors=2
Iteration 44: time=1.80, Factors=2
Iteration 45: time=1.84, Factors=2
Iteration 46: time=3.32, ELBO=-120459.94, deltaELBO=14.764 (0.00414478%), Factors=2
Iteration 47: time=1.85, Factors=2
Iteration 48: time=1.83, Factors=2
Iteration 49: time=1.87, Factors=2
Optimising sigma node...

The data was downloaded from the toturial: MEFISTO application to longitudinal microbiome data.

I just follow the documentation to run the code and try to understand it.