ME-ICA / tedana

TE-dependent analysis of multi-echo fMRI
https://tedana.readthedocs.io
GNU Lesser General Public License v2.1
161 stars 95 forks source link

mapca error #1019

Closed rhl508 closed 8 months ago

rhl508 commented 8 months ago

Hi

I'm using tedana version 23.0.2 and it gets quite far through and then errors at the pca. It looks like it's an issue with mapca. I'm using version 0.0.4 but I tried downgrading to 0.0.3 and that didn't work.

INFO     io:__init__:154 Generating figures directory: /scratch/groups/Projects/P1465/data/sub-002/ses-1/derivatives/tedana/prf/run-1/figures
INFO     tedana:tedana_workflow:564 Using user-defined mask
INFO     tedana:tedana_workflow:612 Computing T2* map
INFO     combine:make_optcom:191 Optimally combining data with voxel-wise T2* estimates
INFO     tedana:tedana_workflow:637 Writing optimally combined data set: /scratch/groups/Projects/P1465/data/sub-002/ses-1/derivatives/tedana/prf/run-1/desc-optcom_bold.nii.gz
INFO     pca:tedpca:202 Computing PCA of optimally combined multi-echo data with selection criteria: aic

Traceback (most recent call last):
  File "/home/r/rhl508/venvs/tedana/bin/tedana", line 8, in <module>
    sys.exit(_main())
  File "/home/r/rhl508/venvs/tedana/lib/python3.9/site-packages/tedana/workflows/tedana.py", line 918, in _main
    tedana_workflow(**kwargs, tedana_command=tedana_command)
  File "/home/r/rhl508/venvs/tedana/lib/python3.9/site-packages/tedana/workflows/tedana.py", line 641, in tedana_workflow
    dd, n_components = decomposition.tedpca(
  File "/home/r/rhl508/venvs/tedana/lib/python3.9/site-packages/tedana/decomposition/pca.py", line 214, in tedpca
    _ = ma_pca.fit_transform(data_img, mask_img)
  File "/home/r/rhl508/venvs/tedana/lib/python3.9/site-packages/mapca/mapca.py", line 478, in fit_transform
    self._fit(img, mask, subsample_depth=subsample_depth)
  File "/home/r/rhl508/venvs/tedana/lib/python3.9/site-packages/mapca/mapca.py", line 404, in _fit
    self.n_features_ = ppca.n_features_
AttributeError: 'PCA' object has no attribute 'n_features_'

Any advice appreciated. Thanks!

rhl508 commented 8 months ago

Received an answer from a colleague that worked. It looks like 'nfeatures' was changed to 'n_featuresin' in newer versions of scikit-learn, so they changed mapca to match this.

I downgraded scikit-learn to 1.1.2 and that fixed it

eurunuela commented 8 months ago

Thank you for reporting this.

First of all, glad you found a workaround!

And second, we may want to open an issue to get this fixed for newer versions of scikit learn.

eurunuela commented 8 months ago

Ok, my bad. It's been a few crazy months. I already opened a pull request in maPCA that fixes this but haven't finished making other changes to merge it. Consider it done next week.

rhl508 commented 8 months ago

Thanks so much!

On Fri 26 Jan 2024, 10:18 Eneko Uruñuela, @.***> wrote:

Ok, my bad. It's been a few crazy months. I already opened a pull request in maPCA https://github.com/ME-ICA/mapca/pull/59 that fixes this but haven't finished making other changes to merge it. Consider it done next week.

— Reply to this email directly, view it on GitHub https://github.com/ME-ICA/tedana/issues/1019#issuecomment-1911804391, or unsubscribe https://github.com/notifications/unsubscribe-auth/BFTGOQBP2O6OTXXIP6QOUILYQN7GTAVCNFSM6AAAAABCKNQRFKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMJRHAYDIMZZGE . You are receiving this because you modified the open/close state.Message ID: @.***>

bedardp2 commented 6 months ago

Hi I still have the error as above. Is this normal?
I'm using tedana version 23.0.2

Also, (or) how can I downgrade to scikit-learn to 1.1.2 as [rhl508] mentioned previously? I'm using tedana within AFNI (afni_proc) and I had error, so I'm trying at CLI (tedana -d pb03.890012.r01.e01.volreg+tlrc.HEAD pb03.890012.r01.e02.volreg+tlrc.HEAD pb03.890012.r01.e03.volreg+tlrc.HEAD -e 19 38.21 57.42 --mask mask_group+tlrc.HEAD --out-dir tedana_r01 --convention orig --overwrite)

I don't see how I can change this I'm really not an expert with python!

I've attached the error message I received error.txt

thank you patrick

eurunuela commented 6 months ago

Hi Patrick, thank you for reporting this.

Could you try updating maPCA to the latest version? Version 0.0.5 fixed this issue.