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

[FIX] bug find_nearest_neighbours #281

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
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
4 changes: 2 additions & 2 deletions ampligraph/discovery/discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -1227,8 +1227,8 @@ def find_nearest_neighbours(kge_model, entities, n_neighbors=10, entities_subset
all_neighbors_emb = kge_model.get_embeddings(entities_subset)
all_neighbors = entities_subset
else:
all_neighbors_emb = kge_model.trained_model_params[0]
all_neighbors = list(kge_model.ent_to_idx.keys())
all_neighbors = list(kge_model.data_indexer.backend.get_all_entities())
all_neighbors_emb = kge_model.get_embeddings(all_neighbors)

assert n_neighbors < len(all_neighbors), 'n_neighbors must be less than the number of entities being fit!'
knn_model = NearestNeighbors(n_neighbors=n_neighbors, metric=metric).fit(all_neighbors_emb)
Expand Down