quaterion.eval.samplers.group_sampler module

class GroupSampler(sample_size=-1, encode_batch_size=16, device: device | str | None = None, log_progress: bool = True)[source]

Bases: BaseSampler

Perform selection of embeddings and targets for group based tasks.

accumulate(model: SimilarityModel, dataset: Sized | Iterable | Dataset)[source]

Encodes objects and accumulates embeddings with the corresponding raw labels

  • model – model to encode objects

  • dataset – Sized object, like list, tuple,, etc. to accumulate


Reset accumulated state

sample(dataset: Sized, metric: GroupMetric, model: SimilarityModel) Tuple[Tensor, Tensor][source]

Sample embeddings and targets for groups based tasks.

  • dataset – Sized object, like list, tuple,, etc. to sample

  • metric – GroupMetric instance to compute final labels representation

  • model – model to encode objects


torch.Tensor, torch.Tensor – metrics labels and computed distance matrix


Learn more about Qdrant vector search project and ecosystem

Discover Qdrant

Similarity Learning

Explore practical problem solving with Similarity Learning

Learn Similarity Learning


Find people dealing with similar problems and get answers to your questions

Join Community