GAA-UAM / scikit-fda

Functional Data Analysis Python package
https://fda.readthedocs.io
BSD 3-Clause "New" or "Revised" License
287 stars 51 forks source link

No skfda.ml.regression attribute FPCARegression #543

Closed catherinening closed 8 months ago

catherinening commented 1 year ago

I am trying to perform FPCA regression using the FPCARegression() functionality, but when I try to import it (from skfda.ml.regression import FPCARegression), I get the following error:

ImportError: cannot import name 'FPCARegression' from 'skfda.ml.regression' ([base directory]/anaconda3/lib/python3.9/site-packages/skfda/ml/regression/__init__.py)

I then try to use the function by importing skfda.ml.regression and then calling FPCARegression(), but that also throws an error:

import skfda.ml.regression as mlr lr = mlr.FPCARegression() results in the following error: AttributeError: No skfda.ml.regression attribute FPCARegression

I even uninstalled skfda (originally installed using Conda forge, and then reinstalled skfda using pip, and I run into the same issues. Every other functionality in skfda.ml.regression seems to work error-free, except FPCARegression.

import skfda
from skfda.ml.regression import FPCARegression
# ImportError

import skfda.ml.regression as mlr
lr = mlr.FPCARegression()
#AttrivbuteError

Version information

vnmabus commented 1 year ago

FPCARegression is available in the develop branch, but has not been yet released. Thus, its documentation is available in for the "latest" version, corresponding to develop (https://fda.readthedocs.io/en/latest), but not in the "stable" version, corresponding to master (https://fda.readthedocs.io/en/stable).

Now, it is possible to install the develop version if you want that functionality, either from source or telling pip that install it from the git repo directly as:

pip install git+https://github.com/GAA-UAM/scikit-fda.git@develop

Alternatively, as FPCA regression is just a linear regression using the FPCA basis (which, if you do not apply penalization, is orthonormal) you can also obtain similar results by using multivariate linear regression with the FPCA scores.

Sorry for the misunderstanding. Maybe we should make "stable" the default documentation to prevent these kinds of issues in the future.

vnmabus commented 8 months ago

As this is available in the recently released 0.9 version, I will consider this issue as closed.