MixtureAnchorSelection

class MixtureAnchorSelection(selections, ratios=None, selections_kwargs=None, **kwargs)[source]

Bases: AnchorSelection

A weighted mixture of different anchor selection strategies.

Initialize the selection strategy.

Parameters:
  • selections (Sequence[Union[str, AnchorSelection, Type[AnchorSelection], None]]) – the individual selections. For the sake of selecting unique anchors, selections will be executed in the given order eg, [‘degree’, ‘pagerank’] will be executed differently from [‘pagerank’, ‘degree’]

  • ratios (Union[None, float, Sequence[float]]) – the ratios, cf. normalize_ratios. None means uniform ratios

  • selections_kwargs (Union[Mapping[str, Any], None, Sequence[Optional[Mapping[str, Any]]]]) – additional keyword-based arguments for the individual selection strategies

  • kwargs – additional keyword-based arguments passed to AnchorSelection.__init__, in particular, the total number of anchors.

Methods Summary

__call__(edge_index[, known_anchors])

Select anchor nodes.

iter_extra_repr()

Extra components for __repr__.

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

iter_extra_repr()[source]

Extra components for __repr__.

Return type:

Iterable[str]