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

[TO_REVIEW] ConditionalTransferableComponentsAdapter Implementation #137

Open
wants to merge 21 commits into
base: main
Choose a base branch
from

Conversation

YanisLalou
Copy link
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 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
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
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
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 ?

@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