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

Add Relation that works with negative edge sampling #9

Closed
einbandi opened this issue Jul 8, 2022 · 2 comments
Closed

Add Relation that works with negative edge sampling #9

einbandi opened this issue Jul 8, 2022 · 2 comments

Comments

@einbandi
Copy link
Collaborator

einbandi commented Jul 8, 2022

The relations that exist so far all calculate square matrices Rel(x_i, x_j) with x_i and x_j in X. For negative edge sampling, a batch consists of row (row) and column (col) indices, so only Rel(x_row[i], y_col[i]) for i from 0 to len(row) - 1 must be calculated. For a single item, len(row) = neg_sampling_rate + 1. I don't want to calculate the full matrix and subsample, as this is inefficient.

@einbandi
Copy link
Collaborator Author

einbandi commented Jul 8, 2022

A quick solution would be to implement DistsFromTo, whose compute_relations method takes a tensor of shape (2, n, dim) and returns a list of n distances in the form of a new RelationData subclass (e.g., RelationTensor and/or RelationArray) without any conversion methods.

@einbandi
Copy link
Collaborator Author

einbandi commented Jul 8, 2022

If this is the only relation that works with negative edge sampling, is there a way to set it by default so it doesn't have to be specified? What about the sub methods that should be implemented for all other relations?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

No branches or pull requests

1 participant