8000 Nca temp by wdevazelhes · Pull Request #1 · wdevazelhes/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content

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

Open
wants to merge 10 commits into
base: nca
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
remove comment
  • Loading branch information
William de Vazelhes committed Oct 27, 2017
commit 22838c5ddb27d0283254b465594172bcaaa6c52c
2 changes: 1 addition & 1 deletion sklearn/neighbors/nca.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Copy link
Collaborator

Choose a reason for hiding this comment

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

can't we just use ~ci and avoid defining this variable?

Copy link
Owner Author

Choose a reason for hiding this comment

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

Yes you are right, I changed it

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(
Copy link
Collaborator

Choose a reason for hiding this comment

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

again, sum_ci and sum_not_ci are distances

(p_i_j[:, np.newaxis] * diff_embedded[ci, :]))
Expand Down
0