chemicalchecker.util.performance.linkprediction.LinkPrediction

class LinkPrediction(sign2, network, metric=<function cosine>, limit_nodes=None)[source]

Bases: object

LinkPrediction class.

Initialize a LinkPrediction instanca. :param sign2: Signature or embedding to validate. :type sign2: sign :param network: The network that we want to reconstruct. :type network: network :param metric: The function used to compute vector distance. :type metric: set :param limit_nodes: Limit sampling to nodes in this set. :type limit_nodes: set

Methods

get_sample_actual_pred

Sample positive (present) and negative (absent).

get_sample_actual_pred(edges_to_sample, metric, limit_nodes)[source]

Sample positive (present) and negative (absent).

Parameters:
  • edges_to_sample (int) – Number of edges to sample per node.

  • metric (func) – The function used to compute vector distance.

  • limit_nodes (set) – Limit sampling to nodes in this set.