Skip to content

[WIP] Domain-invariant partial least squares regression#286

Open
B-Analytics wants to merge 22 commits intoscikit-adaptation:mainfrom
B-Analytics:di-PLS
Open

[WIP] Domain-invariant partial least squares regression#286
B-Analytics wants to merge 22 commits intoscikit-adaptation:mainfrom
B-Analytics:di-PLS

Conversation

@B-Analytics
Copy link
Copy Markdown

Summary

I added the DIPLS class along with the dipals function to skada/_dipls.py and created an example in examples/methods/plot_dipls.py to showcase its usage. In the example, I apply di-PLS to a typical regression task in my domain (analytical chemistry) and tried to highlight the features that make it particularly useful for us (interpretability, flexibility). I also included a comparison with JDOT on the same task. The branch passed all tests (related to the new class and functions) and I updated the documentation accordingly.

@antoinecollas
Copy link
Copy Markdown
Collaborator

Thanks for the PR! It seems your linter changed .circleci/config.yml and .pre-commit-config.yaml which shouldn't be modified. Can you revert these changes?

@antoinecollas antoinecollas changed the title [MRG] Domain-invariant partial least squares regression [WIP] Domain-invariant partial least squares regression Dec 5, 2024
@B-Analytics
Copy link
Copy Markdown
Author

Hi Antoine

I have reverted the changes as you suggested but it seems that the tests are still not successful...

@rflamary
Copy link
Copy Markdown
Collaborator

Hello @B-Analytics ,

You need to merge the README.md file because the current merge conflit prevent te doc and the test from running.

@B-Analytics
Copy link
Copy Markdown
Author

Got it!

@B-Analytics
Copy link
Copy Markdown
Author

B-Analytics commented Dec 11, 2024

Hey guys

I still face problems with the tests. However, this time the problem is associated with the docs. Following files seem to cause the problem:

../../examples/deep/plot_adversarial.py
../../examples/deep/plot_divergence.py
../../examples/deep/plot_optimal_transport.py

Can you please give me a hand?

@antoinecollas
Copy link
Copy Markdown
Collaborator

You can generate and open the doc locally with
make clean && make html && open build/html/index.html
in the docs folder. Tell me if it helps you or not.

@B-Analytics
Copy link
Copy Markdown
Author

I can build the documentation locally
image
but it fails on circleci for some reason:
image

@antoinecollas
Copy link
Copy Markdown
Collaborator

antoinecollas commented Dec 14, 2024

Which version of scikit-learn are you using?
I think I found the problem:
skorch is not compatible with version 1.6.0 of scikit-learn yet (skorch-dev/skorch#1076). circle-ci pulls 1.6.0, and thus, the documentation cannot be built... So, I think your problem is independent of your PR. It also explains why "Test-minimal" pass but not "Test," which relies on skorch.

@B-Analytics
Copy link
Copy Markdown
Author

Yes, I am using scikit-learn v1.5.2 on my local machine. Let me know if I can do something to move this forward.

@antoinecollas
Copy link
Copy Markdown
Collaborator

Skorch’s new version is coming soon: skorch-dev/skorch#1085. It should fix the CI!

@tgnassou
Copy link
Copy Markdown
Collaborator

The scikit-learn team fixed the problem; let's check if the tests pass now!

@tgnassou
Copy link
Copy Markdown
Collaborator

Hello @B-Analytics! Now that the tests are passing, can we review or do you still need some time to finish them?

@B-Analytics
Copy link
Copy Markdown
Author

@tgnassou, yes please go ahead with the review. Thx!

on the source and target domain, the DIPLS and JDOT Regressor on the same task and
illustrate the learned (domain-invariant) features.

.. [36] Nikzad-Langerodi, R., Zellinger, W., Saminger-Platz, S., & Moser, B. A. (2020).
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's 37 now

Comment thread skada/__init__.py
JCPOTLabelPropAdapter,
JCPOTLabelProp)

from ._dipls import (
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to put it in two lines

Comment thread skada/_dipls.py
----------
xs : ndarray of shape (n_source_samples, n_features)
Feature data from the source domain.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't put space between lines of params

Comment thread skada/_dipls.py Outdated

References
----------
Ramin Nikzad-Langerodi et al., "Domain-Invariant Regression
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing ref number

Comment thread skada/_dipls.py Outdated

Parameters
----------
xs : ndarray of shape (n_source_samples, n_features)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

try to keep the convention of skada using Xs instead of xs

Comment thread skada/_dipls.py Outdated
# Preliminaries
self.n_, self.n_features_in_ = Xs.shape
self.ns_, _ = Xs.shape
self.x_ = Xs
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't get why you use x and xs while there are the same data?

@tgnassou
Copy link
Copy Markdown
Collaborator

I made a little review but more to format the code writing. I'll read more in-depth soon. However, your PR lacks tests for your method to check if everything's working fine. Just get inspired by the already existing tests for shallow methods.

@tgnassou
Copy link
Copy Markdown
Collaborator

tgnassou commented Apr 8, 2025

Hi @B-Analytics, I try to improve a bit the code:

  • Removed redundant parameters. You did everything for X and X_s.
  • Removed not-used attributes to lighten the code a bit. I hope I didn't remove something important.

Let me know if you have any question, and you PR still need a test to check if everything is working weel:)

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

Successfully merging this pull request may close these issues.

5 participants