MixtureAnchorSelection

class MixtureAnchorSelection(selections: Sequence[str | AnchorSelection | type[AnchorSelection] | None], ratios: None | float | Sequence[float] = None, selections_kwargs: Mapping[str, Any] | None | Sequence[Mapping[str, Any] | None] = None, **kwargs)[source]

Bases: AnchorSelection

A weighted mixture of different anchor selection strategies.

Initialize the selection strategy.

Parameters:
  • selections (Sequence[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 (None | float | Sequence[float]) – the ratios, cf. normalize_ratios. None means uniform ratios

  • selections_kwargs (Mapping[str, Any] | None | Sequence[Mapping[str, Any] | None]) – 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: 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.

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

  • known_anchors (ndarray | None) – numpy.ndarray an array of already known anchors for getting only unique anchors

Returns:

(k,) the selected entity ids

Return type:

ndarray

iter_extra_repr() Iterable[str][source]

Extra components for __repr__.

Return type:

Iterable[str]