Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError for CCA test from documentation. #201

Open
teakfi opened this issue Dec 10, 2024 · 0 comments
Open

AttributeError for CCA test from documentation. #201

teakfi opened this issue Dec 10, 2024 · 0 comments

Comments

@teakfi
Copy link

teakfi commented Dec 10, 2024

import cca_zoo
import numpy as np

rng=np.random.RandomState(0)

X1 = rng.random((10,5))

X2 = rng.random((10,5))

model = CCA()

model.fit((X1,X2)).score((X1,X2))
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[17], line 11
      7 X2 = rng.random((10,5))
      9 model = CCA()
---> 11 model.fit((X1,X2)).score((X1,X2))

File E:\anaconda3\envs\analysis\Lib\site-packages\cca_zoo\linear\_mcca.py:78, in MCCA.fit(self, views, y, **kwargs)
     76 def fit(self, views: Iterable[np.ndarray], y=None, **kwargs):
     77     # Validate the input data
---> 78     views = self._validate_data(views)
     79     # Check the parameters
     80     self._check_params()

File E:\anaconda3\envs\analysis\Lib\site-packages\cca_zoo\_base.py:58, in _BaseModel._validate_data(self, views)
     57 def _validate_data(self, views: Iterable[np.ndarray]):
---> 58     if not self._get_tags().get("multiview", False) and len(views) > 2:
     59         raise ValueError(
     60             f"Model can only be used with two representations, but {len(views)} were given. "
     61             "Use MCCA or GCCA instead for CCA or MPLS for PLS."
     62         )
     63     if self.copy_data:

File E:\anaconda3\envs\analysis\Lib\site-packages\sklearn\base.py:417, in BaseEstimator._get_tags(self)
    409 from sklearn.utils._tags import _to_old_tags, get_tags
    411 warnings.warn(
    412     "The `_get_tags` method is deprecated in 1.6 and will be removed in "
    413     "1.7. Please implement the `__sklearn_tags__` method.",
    414     category=FutureWarning,
    415 )
--> 417 return _to_old_tags(get_tags(self))

File E:\anaconda3\envs\analysis\Lib\site-packages\sklearn\utils\_tags.py:405, in get_tags(estimator)
    403 for klass in reversed(type(estimator).mro()):
    404     if "__sklearn_tags__" in vars(klass):
--> 405         sklearn_tags_provider[klass] = klass.__sklearn_tags__(estimator)  # type: ignore[attr-defined]
    406         class_order.append(klass)
    407     elif "_more_tags" in vars(klass):

File E:\anaconda3\envs\analysis\Lib\site-packages\sklearn\base.py:859, in TransformerMixin.__sklearn_tags__(self)
    858 def __sklearn_tags__(self):
--> 859     tags = super().__sklearn_tags__()
    860     tags.transformer_tags = TransformerTags()
    861     return tags

AttributeError: 'super' object has no attribute '__sklearn_tags__'

Sklearn version 1.6, run on windows 10 anaconda/jupyter lab.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant