Skip to content

[TO_REVIEW] ConditionalTransferableComponentsAdapter Implementation#137

Open
YanisLalou wants to merge 21 commits intoscikit-adaptation:mainfrom
YanisLalou:conditional_transferable_components
Open

[TO_REVIEW] ConditionalTransferableComponentsAdapter Implementation#137
YanisLalou wants to merge 21 commits intoscikit-adaptation:mainfrom
YanisLalou:conditional_transferable_components

Conversation

@YanisLalou
Copy link
Copy Markdown
Collaborator

Fixes: #96
Paper: https://proceedings.mlr.press/v48/gong16.pdf
Mostly eq 7-8-9-10

@kachayev kachayev added the algorithm Implementation or improvements of the DA methods label Mar 5, 2024
Comment thread skada/_subspace.py Outdated
Comment on lines +1229 to +1241
# Define constraint function for Grassmann manifold: W^TW = I_d
# def grassmann_constraint_function(W):
# return np.dot(W.T, W) - np.eye(n_components)

# grassmann_constraint = {
# "type": "eq",
# "fun": grassmann_constraint_function,
# }

(_, W, _, _), _ = torch_minimize(
func_torch, (alpha, W, G, H), tol=self.tol, max_iter=1
)
W = torch.tensor(W, dtype=torch.float64)
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Here any idea how to enforce the constraint to the torch minimiser ?

Copy link
Copy Markdown
Contributor

@ambroiseodt ambroiseodt May 6, 2024

Choose a reason for hiding this comment

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

hello, here are a couple of ideas:

  • Use the dual of the optimization problem resulting in adding the constraint to the loss in Pytorch:
    min_x f(x) st g(x) = 0 <==> min_{x, lambda} f(x) + lambda * g(x)
    here the constraint would be the norm of W^TW - Id

  • Another idea could be to generate the matrices directly on the Grassmanian manifold:
    a) geomtorch: https://geotorch.readthedocs.io/en/latest/orthogonal/grassmannian.html

b) torch: https://pytorch.org/docs/stable/generated/torch.nn.utils.parametrizations.orthogonal.html
Une autre methode, c'est de parametriser tes fonctions tq ce soit orthogonal avec

@rflamary @antoinecollas do you have any suggestions?

@YanisLalou
Copy link
Copy Markdown
Collaborator Author

YanisLalou commented May 7, 2024

By guaranteeing that W is on the Grassmann manifold we loose performance in the Subspace method example on subspace shift dataset as illustrated here:

With constraint:
image

Without constraint:
image

In the bench here are the results for constrained/unconstrained CTC:
image

Is it expected or is there an issue ?

@rflamary rflamary requested a review from antoinecollas May 13, 2024 08:42
@YanisLalou YanisLalou changed the title [WIP] ConditionalTransferableComponentsAdapter Implementation [TO_REVIEW] ConditionalTransferableComponentsAdapter Implementation May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

algorithm Implementation or improvements of the DA methods

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Multidomain source target split and merge

4 participants