MOFA2 icon indicating copy to clipboard operation
MOFA2 copied to clipboard

Error running MOFA with covariates (MEFISTO)

Open smdabdoub opened this issue 1 year ago • 1 comments

Hello everyone,

First, I just wanted to express my thanks for the software; especially tutorials, documentation, and explanations. Those are some of the main reasons I enjoy using the MOFA framework and use it instead of other software.

I am running the following:

R version 4.4.1 (2024-06-14) -- "Race for Your Life"
Platform: aarch64-apple-darwin20

BiocManager 1.30.25
MOFA2 1.13.0
reticulate 1.39.0

And I have installed mofapy2 0.7.2 in a conda environment for use with reticulate instead of basilisk.

I have previously run MEFISTO with a time covariate successfully, but when I tried it recently I ran into errors during the model training. In case it was some issue with my data, I went back to run the Illustration of MEFISTO on simulated data with a temporal covariate tutorial and ran into the same error which is below, starting from the run_mofa() step at the end of the tutorial.

Note that I can run a standard MOFA analysis just fine, as long as I don't specify a covariate and include mefisto options in the model object (prepare_mofa).

(Also note the odd version warning at the end)

> sm <- run_mofa(sm)
Connecting to the mofapy2 python package using reticulate (use_basilisk = FALSE)... 
    Please make sure to manually specify the right python binary when loading R with reticulate::use_python(..., force=TRUE) or the right conda environment with reticulate::use_condaenv(..., force=TRUE)
    If you prefer to let us automatically install a conda environment with 'mofapy2' installed using the 'basilisk' package, please use the argument 'use_basilisk = TRUE'


        #########################################################
        ###           __  __  ____  ______                    ### 
        ###          |  \/  |/ __ \|  ____/\    _             ### 
        ###          | \  / | |  | | |__ /  \ _| |_           ### 
        ###          | |\/| | |  | |  __/ /\ \_   _|          ###
        ###          | |  | | |__| | | / ____ \|_|            ###
        ###          |_|  |_|\____/|_|/_/    \_\              ###
        ###                                                   ### 
        ######################################################### 
       
 
        
use_float32 set to True: replacing float64 arrays by float32 arrays to speed up computations...

Successfully loaded view='view_1' group='group1' with N=200 samples and D=200 features...
Successfully loaded view='view_2' group='group1' with N=200 samples and D=200 features...
Successfully loaded view='view_3' group='group1' with N=200 samples and D=200 features...
Successfully loaded view='view_4' group='group1' with N=200 samples and D=200 features...


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


Model options:
- Automatic Relevance Determination prior on the factors: False
- 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 (view_1): gaussian
- View 1 (view_2): gaussian
- View 2 (view_3): gaussian
- View 3 (view_4): gaussian




######################################
## Training the model with seed 42 ##
######################################


ELBO before training: -649656.15 

Iteration 1: time=0.08, ELBO=-108718.07, deltaELBO=540938.079 (83.26529039%), Factors=4
Iteration 2: time=0.02, Factors=4
Iteration 3: time=0.04, Factors=4
Iteration 4: time=0.03, Factors=4
Iteration 5: time=0.01, Factors=4
Iteration 6: time=0.03, ELBO=-59372.90, deltaELBO=49345.165 (7.59558196%), Factors=4
Iteration 7: time=0.03, Factors=4
Iteration 8: time=0.03, Factors=4
Iteration 9: time=0.02, Factors=4
Iteration 10: time=0.02, Factors=4
Iteration 11: time=0.03, ELBO=-59217.18, deltaELBO=155.720 (0.02396964%), Factors=4
Iteration 12: time=0.01, Factors=4
Iteration 13: time=0.09, Factors=4
Iteration 14: time=0.03, Factors=4
Iteration 15: time=0.02, Factors=4
Iteration 16: time=0.07, ELBO=-59073.56, deltaELBO=143.625 (0.02210777%), Factors=4
Iteration 17: time=0.03, Factors=4
Iteration 18: time=0.03, Factors=4
Iteration 19: time=0.03, Factors=4
Exception ignored in PyObject_HasAttrString(); consider using PyObject_HasAttrStringWithError(), PyObject_GetOptionalAttrString() or PyObject_GetAttrString():
AttributeError: 'NoneType' object has no attribute '__context__'
Optimising sigma node...
Error in py_call_impl(callable, call_args$unnamed, call_args$named) : 
  AttributeError: `np.Inf` was removed in the NumPy 2.0 release. Use `np.inf` instead.
Run `reticulate::py_last_error()` for details.
In addition: Warning messages:
1: In run_mofa(sm) :
  No output filename provided. Using /var/folders/sg/blbm7q8x68s5shz9gs3gh88w0000gn/T//Rtmpdyzzkn/mofa_20241029-125326.hdf5 to store the trained model.

2: In run_mofa(sm) :
  The latest mofapy2 version is 0.7.0, you are using 0.7.2. Please upgrade with 'pip install mofapy2'

smdabdoub avatar Oct 29 '24 19:10 smdabdoub