AnchorSelection
- class AnchorSelection(num_anchors: int = 32)[source]
Bases:
ExtraReprMixin
,ABC
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: ndarray, known_anchors: ndarray | None = None) ndarray [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.
- filter_unique(anchor_ranking: ndarray, known_anchors: ndarray | None) ndarray [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:
- Returns:
shape: (m + num_anchors,) the extended anchors, i.e., the known ones and num_anchors novel ones.
- Return type: