Skip to content

Pick

moll.pick.OnlineDiversityPicker

OnlineDiversityPicker(
    capacity: int,
    *,
    similarity_fn: SimilarityFnCallable | SimilarityFnLiteral = "euclidean",
    potential_fn: PotentialFnCallable | PotentialFnLiteral = "hyperbolic",
    p: float | int = 1,
    k_neighbors: int | float = 5,
    threshold: float = -jnp.inf,
    dtype: DTypeLike | None = None
)

Greedy algorithm for picking a diverse subset of points in an online fashion.

Initialize the picker.

dim property

dim: int | None

Return the dimension of the points.

labels property

labels: list | None

Return the currently picked labels.

n_rejected property

n_rejected: int

Return the number of rejected points.

points property

points: Array | None

Return the currently picked points.

size property

size: int

Return the number of points in the picker.

add

add(point: Array, label: Hashable | None = None) -> bool

Add a point to the picker.

is_empty

is_empty() -> bool

Return whether the picker is empty or not.

is_full

is_full() -> bool

Return whether the picker is full or not.

update

update(points: Iterable, labels: Indexable[Hashable] | None = None) -> int

Add a batch of points to the picker.

warm

warm(points: Array, labels: Indexable[Hashable] | None = None)

Initialize the picker with a set of points.