-
Notifications
You must be signed in to change notification settings - Fork 0
Nca temp #1
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
base: nca
Are you sure you want to change the base?
Nca temp #1
Changes from 3 commits
010a211
9f1157d
22838c5
8a9ff5b
76f3544
0cee29d
507b763
f6d0973
4c0494d
fb8cefa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,7 +27,7 @@ class NeighborhoodComponentAnalysis(BaseEstimator, TransformerMixin): | |
|
||
Parameters | ||
---------- | ||
n_features_out: int, optional (default=None) | ||
n_features_out : int, optional (default=None) | ||
Preferred dimensionality of the embedding. | ||
|
||
init : string or numpy array, optional (default='pca') | ||
|
@@ -87,10 +87,10 @@ class NeighborhoodComponentAnalysis(BaseEstimator, TransformerMixin): | |
Attributes | ||
---------- | ||
transformation_ : array, shape (n_features_out, n_features) | ||
The linear transformation learned during fitting. | ||
The linear transformation learned during fitting. | ||
|
||
n_iter_ : int | ||
Counts the number of iterations performed by the optimizer. | ||
Counts the number of iterations performed by the optimizer. | ||
|
||
opt_result_ : scipy.optimize.OptimizeResult (optional) | ||
A dictionary of information representing the optimization result. | ||
|
@@ -121,9 +121,9 @@ class NeighborhoodComponentAnalysis(BaseEstimator, TransformerMixin): | |
Notes | ||
----- | ||
Neighborhood Component Analysis (NCA) is a machine learning algorithm for | ||
metric learning. It learns a linear transformation of the space in a | ||
supervised fashion to improve the classification accuracy of a | ||
stochastic nearest neighbors rule in this new space. | ||
metric learning. It learns a linear transformation in a supervised fashion | ||
to improve the classification accuracy of a stochastic nearest neighbors | ||
rule in the new space. | ||
|
||
.. warning:: | ||
|
||
|
@@ -445,7 +445,7 @@ def _loss_grad_lbfgs(self, transformation, X, y, diffs, | |
ci = masks[:, y[i]] | ||
p_i_j = soft[ci] | ||
not_ci = np.logical_not(ci) | ||
|
||
diff_ci = diffs[i, ci, :] # n_samples * n_features | ||
diff_ci = diffs[i, ci, :] | ||
diff_not_ci = diffs[i, not_ci, :] | ||
sum_ci = diff_ci.T.dot( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. again, |
||
(p_i_j[:, np.newaxis] * diff_embedded[ci, :])) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
transformed space
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done