bioFAM / mofapy2

Multi-omics factor analysis v2
https://biofam.github.io/MOFA2/
GNU Lesser General Public License v3.0
34 stars 28 forks source link

Crash depending on normalization #21

Open AJPreto opened 7 months ago

AJPreto commented 7 months ago

I have been experimenting some alternative ways to normalize the data, but, for some reason, a few of them crash the model when training. The crash snippet is below:

ELBO before training: -11480018.67 

Iteration 1: time=170.32, ELBO=-1483968.21, deltaELBO=9996050.457 (87.07346866%), Factors=9
Iteration 2: time=155.26, ELBO=-1402406.25, deltaELBO=81561.958 (0.71046886%), Factors=8
Iteration 3: time=140.18, ELBO=-1401338.20, deltaELBO=1068.051 (0.00930356%), Factors=7
Iteration 4: time=125.85, ELBO=-1400270.60, deltaELBO=1067.606 (0.00929969%), Factors=6
Iteration 5: time=112.09, ELBO=-1399202.99, deltaELBO=1067.605 (0.00929968%), Factors=5
Iteration 6: time=98.70, ELBO=-1398135.39, deltaELBO=1067.605 (0.00929968%), Factors=4
Iteration 7: time=84.30, ELBO=-1397067.78, deltaELBO=1067.604 (0.00929967%), Factors=3
Iteration 8: time=70.65, ELBO=-1396000.18, deltaELBO=1067.604 (0.00929967%), Factors=2
Iteration 9: time=54.47, ELBO=-1394932.58, deltaELBO=1067.603 (0.00929966%), Factors=1
All factors shut down, no structure found in the data.
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In[32], [line 1](vscode-notebook-cell:?execution_count=32&line=1)
----> [1](vscode-notebook-cell:?execution_count=32&line=1) ent.run()

File [~/.venv/lib64/python3.9/site-packages/mofapy2/run/entry_point.py:57](https://vscode-remote+ssh-002dremote-002b7b22686f73744e616d65223a226563322d494244227d.vscode-resource.vscode-cdn.net/home/ec2-user/precision-medicine/notebooks/CCF/multiomics/~/.venv/lib64/python3.9/site-packages/mofapy2/run/entry_point.py:57), in keyboardinterrupt_saver.<locals>.saver(self, *args, **kwargs)
     [54](https://vscode-remote+ssh-002dremote-002b7b22686f73744e616d65223a226563322d494244227d.vscode-resource.vscode-cdn.net/home/ec2-user/precision-medicine/notebooks/CCF/multiomics/~/.venv/lib64/python3.9/site-packages/mofapy2/run/entry_point.py:54) @wraps(func)
     [55](https://vscode-remote+ssh-002dremote-002b7b22686f73744e616d65223a226563322d494244227d.vscode-resource.vscode-cdn.net/home/ec2-user/precision-medicine/notebooks/CCF/multiomics/~/.venv/lib64/python3.9/site-packages/mofapy2/run/entry_point.py:55) def saver(self, *args, **kwargs):
     [56](https://vscode-remote+ssh-002dremote-002b7b22686f73744e616d65223a226563322d494244227d.vscode-resource.vscode-cdn.net/home/ec2-user/precision-medicine/notebooks/CCF/multiomics/~/.venv/lib64/python3.9/site-packages/mofapy2/run/entry_point.py:56)     try:
---> [57](https://vscode-remote+ssh-002dremote-002b7b22686f73744e616d65223a226563322d494244227d.vscode-resource.vscode-cdn.net/home/ec2-user/precision-medicine/notebooks/CCF/multiomics/~/.venv/lib64/python3.9/site-packages/mofapy2/run/entry_point.py:57)         func(self, *args, **kwargs)
     [58](https://vscode-remote+ssh-002dremote-002b7b22686f73744e616d65223a226563322d494244227d.vscode-resource.vscode-cdn.net/home/ec2-user/precision-medicine/notebooks/CCF/multiomics/~/.venv/lib64/python3.9/site-packages/mofapy2/run/entry_point.py:58)     # Internal methods will raise TypeError when interrupted
     [59](https://vscode-remote+ssh-002dremote-002b7b22686f73744e616d65223a226563322d494244227d.vscode-resource.vscode-cdn.net/home/ec2-user/precision-medicine/notebooks/CCF/multiomics/~/.venv/lib64/python3.9/site-packages/mofapy2/run/entry_point.py:59)     except (KeyboardInterrupt, TypeError):

File [~/.venv/lib64/python3.9/site-packages/mofapy2/run/entry_point.py:1434](https://vscode-remote+ssh-002dremote-002b7b22686f73744e616d65223a226563322d494244227d.vscode-resource.vscode-cdn.net/home/ec2-user/precision-medicine/notebooks/CCF/multiomics/~/.venv/lib64/python3.9/site-packages/mofapy2/run/entry_point.py:1434), in entry_point.run(self)
   [1431](https://vscode-remote+ssh-002dremote-002b7b22686f73744e616d65223a226563322d494244227d.vscode-resource.vscode-cdn.net/home/ec2-user/precision-medicine/notebooks/CCF/multiomics/~/.venv/lib64/python3.9/site-packages/mofapy2/run/entry_point.py:1431) self.model.setTrainOptions(self.train_opts)
   [1433](https://vscode-remote+ssh-002dremote-002b7b22686f73744e616d65223a226563322d494244227d.vscode-resource.vscode-cdn.net/home/ec2-user/precision-medicine/notebooks/CCF/multiomics/~/.venv/lib64/python3.9/site-packages/mofapy2/run/entry_point.py:1433) # Train the model
-> [1434](https://vscode-remote+ssh-002dremote-002b7b22686f73744e616d65223a226563322d494244227d.vscode-resource.vscode-cdn.net/home/ec2-user/precision-medicine/notebooks/CCF/multiomics/~/.venv/lib64/python3.9/site-packages/mofapy2/run/entry_point.py:1434) train_model(self.model)

File [~/.venv/lib64/python3.9/site-packages/mofapy2/build_model/train_model.py:27](https://vscode-remote+ssh-002dremote-002b7b22686f73744e616d65223a226563322d494244227d.vscode-resource.vscode-cdn.net/home/ec2-user/precision-medicine/notebooks/CCF/multiomics/~/.venv/lib64/python3.9/site-packages/mofapy2/build_model/train_model.py:27), in train_model(model)
     [24](https://vscode-remote+ssh-002dremote-002b7b22686f73744e616d65223a226563322d494244227d.vscode-resource.vscode-cdn.net/home/ec2-user/precision-medicine/notebooks/CCF/multiomics/~/.venv/lib64/python3.9/site-packages/mofapy2/build_model/train_model.py:24) print("#" * 38)
     [25](https://vscode-remote+ssh-002dremote-002b7b22686f73744e616d65223a226563322d494244227d.vscode-resource.vscode-cdn.net/home/ec2-user/precision-medicine/notebooks/CCF/multiomics/~/.venv/lib64/python3.9/site-packages/mofapy2/build_model/train_model.py:25) print("\n")
---> [27](https://vscode-remote+ssh-002dremote-002b7b22686f73744e616d65223a226563322d494244227d.vscode-resource.vscode-cdn.net/home/ec2-user/precision-medicine/notebooks/CCF/multiomics/~/.venv/lib64/python3.9/site-packages/mofapy2/build_model/train_model.py:27) model.iterate()
     [29](https://vscode-remote+ssh-002dremote-002b7b22686f73744e616d65223a226563322d494244227d.vscode-resource.vscode-cdn.net/home/ec2-user/precision-medicine/notebooks/CCF/multiomics/~/.venv/lib64/python3.9/site-packages/mofapy2/build_model/train_model.py:29) print("\n")
     [30](https://vscode-remote+ssh-002dremote-002b7b22686f73744e616d65223a226563322d494244227d.vscode-resource.vscode-cdn.net/home/ec2-user/precision-medicine/notebooks/CCF/multiomics/~/.venv/lib64/python3.9/site-packages/mofapy2/build_model/train_model.py:30) print("#" * 23)
...
--> [216](https://vscode-remote+ssh-002dremote-002b7b22686f73744e616d65223a226563322d494244227d.vscode-resource.vscode-cdn.net/home/ec2-user/precision-medicine/notebooks/CCF/multiomics/~/.venv/lib64/python3.9/site-packages/mofapy2/core/BayesNet.py:216)     exit()
    [218](https://vscode-remote+ssh-002dremote-002b7b22686f73744e616d65223a226563322d494244227d.vscode-resource.vscode-cdn.net/home/ec2-user/precision-medicine/notebooks/CCF/multiomics/~/.venv/lib64/python3.9/site-packages/mofapy2/core/BayesNet.py:218) if return_idx:
    [219](https://vscode-remote+ssh-002dremote-002b7b22686f73744e616d65223a226563322d494244227d.vscode-resource.vscode-cdn.net/home/ec2-user/precision-medicine/notebooks/CCF/multiomics/~/.venv/lib64/python3.9/site-packages/mofapy2/core/BayesNet.py:219)     return drop

NameError: name 'exit' is not defined

This error occurs when I use ent.set_data_options(scale_views=True), but also when I tried normalizing the data outside of the package's scope. I realize it might be just informing on the results, but I leave the log here in case it might help you improve on the reporting.