SingleSelection

class SingleSelection(num_anchors=32)[source]

Bases: AnchorSelection, ABC

Single-step selection.

Initialize the strategy.

Parameters

num_anchors (int) – the number of anchor nodes to select. # TODO: allow relative

Methods Summary

__call__(edge_index[, known_anchors])

Select anchor nodes.

rank(edge_index)

Rank nodes.

Methods Documentation

__call__(edge_index, known_anchors=None)[source]

Select anchor nodes.

Note

the number of selected anchors may be smaller than \(k\), if there are less entities present in the edge index.

Parameters
  • edge_index (ndarray) – shape: (m, 2) the edge_index, i.e., adjacency list.

  • known_anchors (Optional[ndarray]) – numpy.ndarray an array of already known anchors for getting only unique anchors

Return type

ndarray

Returns

(k,) the selected entity ids

abstract rank(edge_index)[source]

Rank nodes.

Parameters

edge_index (ndarray) – shape: (m, 2) the edge_index, i.e., adjacency list.

Return type

ndarray

Returns

(n,) the node IDs sorted decreasingly by anchor selection preference.