xarray-contrib / xeofs

Comprehensive EOF analysis in Python with xarray: A versatile, multidimensional, and scalable tool for advanced climate data analysis
https://xeofs.readthedocs.io/
MIT License
105 stars 20 forks source link

feat: add Continuum Power CCA #196

Closed nicrie closed 2 months ago

nicrie commented 2 months ago

This PR introduces Continuous Power CCA (CPCCA) model to the API (close #178 ). Along with this, significant refactoring of the _CrossBaseModel class was required, leading to the addition of several new features.

Key Changes

  1. New Features:

    • Added the ContinuousPowerCCA class and its Hilbert version ComplexCPCCA.
    • Enhanced MCA classes with new functionalities related to correlation coefficients, explained variance and a predict method for forecasting Y from X (see here.
    • Introduced homogeneous_patterns() and heterogeneous_patterns() methods for the ComplexMCA model.
  2. Testing:

    • Added basics tests for ContinuousPowerCCA
    • Updated some of the existing tests for MCA classes to align with changes in default parameters
  3. Miscellaneous:

    • Refactored MCA class (now a special case of ContinuousPowerCCA) along with related clases: ComplexMCA, MCARotator, ComplexMCARotator.
    • Split the original base models into three classes, separating functionalities regarding serialization and lazy model evaluation into _BaseModel, with specific model implementations now in _BaseModelSingleSet and _BaseModelCossSet.

Open To Dos

nicrie commented 2 months ago

Hey @slevang, would you like to review this PR? It’s a bit extensive - sorry about that! No worries if you’re busy; I plan to merge it into the develop branch along with some other breaking changes before it goes live.

slevang commented 2 months ago

I'll try to take a look at the serialization issue in the next few days, but probably won't have time to dig into the rest of the implementation right now. Nice work though, this looks cool!