Server module¶
The server class is used to predict triples or statements, or find similar entities on the model.
Server class¶
Here is shown all the different methods to use with Server class
-
class
kgeserver.server.
Server
(search_index)[source]¶ The server can perform prediction operations
-
distance_between_entities
(entity_x, entity_y)[source]¶ Gives the distance between two different elements
Parameters: - entity_x (integer) – One entity to be compared
- entity_y (integer) – Other entity to be compared
Returns: The distance between two elements
Return type:
-
similarity_by_embedding
(embedd, k, search_k=-1)[source]¶ For a given embedding, return most similar id’s
Parameters: Returns: A list with k id’s, which are the most similar entities
Return type:
-
similarity_by_id
(id, k, search_k=-1)[source]¶ Given an entity id, return the k’th most similar entities
Returns a list of pairs, where the first item is the entity and the second item is the distance to entity.
Parameters: Returns: A list with k id’s, which are the most similar entities
Return type: list of pairs
-
SearchIndex Class¶
This class is used to provide an extra layer to the server. Can perform loads and savings to disk of the index.
Here is shown all the different methods to use with SearchIndex class
-
class
kgeserver.server.
SearchIndex
[source]¶ The search index manages search indexes on disk
This support creating indexes and operations to save/load to/from disk
-
build_from_trained_model
(trained_model, depth)[source]¶ Creates an index from a trained model
Parameters: - trained_model (TrainedModel) – The trained model
- depth (int) – The depth desired to generate the search index
-