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

Dimensionality reduction for algorithms learning Mahalanobis matrix M #167

Open
wdevazelhes opened this issue Feb 4, 2019 · 3 comments
Open
Milestone

Comments

@wdevazelhes
Copy link
Member

For all Mahalanobis metric learners, we should be able to reduce the dimension. For those that optimize the transformation matrix L, this can be done explicitely by setting the matrix at init to have shape (num_dims, n_features). For the others (that optimize the metric M), we could provide the user with num_dims which could be set to:

  • a number k > n_features: in this case we would do the eigendecomposition of M and would only keep the k components with highest eigenvalues
  • similar to scikit-learn's PCA, it could also be a value between 0 and 1 for say some threshold on the eigenvalues, or even a string, for some custom strategy (for instance the elbow rule)

This is the current state in the package:

  • All metric learners that use transformer_from_metric (Covariance, LSML, MMC, and SDML) do not have a num_dims argument
  • All others optimize explicitely L, and have a num_dims argument (LFDA, MLKR, NCA, RCA) except LMNN, that could have one

Also, should we replace num_dims by n_components, like this is the case in scikit learn linear transformers ? This is also what we did for this PR on NCA in scikit-learn scikit-learn/scikit-learn#10058

This is also related to #124, since we should check that in the case of a custom matrix for initializing the explicit transformer it is consistent with the desired dimension

@wdevazelhes wdevazelhes added this to the v0.5.0 milestone Feb 4, 2019
@bellet
Copy link
Member

bellet commented Feb 14, 2019

We should definitely do this for all algorithms learning the transformation matrix L

For M I am not sure because it would not change the learning algorithm, it is only post-processing the solution and the impact on the quality can be very large, and hard to understand for the user. A better way is to add trace regularization to encourage the learned M to be low rank (in which case one can safely ignore the eigenvectors corresponding to eigenvalues equal 0). In this case one cannot choose num_dims explicitly but indirectly by varying the strength of the regularization

@bellet bellet closed this as completed Feb 14, 2019
@bellet bellet reopened this Feb 14, 2019
@wdevazelhes
Copy link
Member Author

Let's just add this for LMNN and add trace regularization in a next release

@bellet bellet changed the title Dimensionality reduction for all algorithms Dimensionality reduction for algorithms learning Mahalanobis matrix M Jun 7, 2019
@bellet
Copy link
Member

bellet commented Jun 7, 2019

Done for LMNN in #193, so I renamed this and flagged it for 0.6.0

@bellet bellet modified the milestones: v0.5.0, v0.6.0 Jun 7, 2019
@bellet bellet modified the milestones: v0.6.0, v0.7.0 Jul 31, 2020
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

2 participants