AnchorSelection¶

class AnchorSelection(num_anchors=32)[source]

Anchor entity selection strategy.

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. filter_unique(anchor_ranking, known_anchors) Filter out already known anchors, and select from remaining ones afterwards. Extra components for __repr__.

Methods Documentation

abstract __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:
Return type:

ndarray

Returns:

(k,) the selected entity ids

filter_unique(anchor_ranking, known_anchors)[source]

Filter out already known anchors, and select from remaining ones afterwards.

Note

the output size may be smaller, if there are not enough candidates remaining.

Parameters:
Return type:

ndarray

Returns:

shape: (m + num_anchors,) the extended anchors, i.e., the known ones and num_anchors novel ones.

iter_extra_repr()[source]

Extra components for __repr__.

Return type: