Practical overview
When it fits
Use Apricot during dataset preparation when a smaller representative sample could support model training or visualization. Consider the memory implications before choosing similarity-based facility-location selection on very large datasets.
Who it is for
- Machine-learning practitioners preparing training data from large datasets.
- Researchers and data teams creating representative summaries for visualization or experiments.
Documented uses
- Select a smaller set of examples before model training.
- Summarize dataset diversity for visualization.
- Choose subsets using built-in submodular functions and optimization strategies.
Requirements & limits
The public GitHub repository lists an MIT license. Its README documents installation from PyPI with `pip install apricot-select`.
- Apricot offers multiple built-in submodular functions, including feature-based, facility location, graph cut, maximum coverage and sum redundancy.
- Several optimizer choices are available, including lazy greedy, stochastic greedy and two-stage greedy.
- Facility location can select examples representing underrepresented parts of the data, but its full similarity matrix has quadratic memory requirements.
- The selectors provide fit, transform and fit_transform methods in a scikit-learn-style interface.
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Select a subset with facility location
Reduce a dataset to a specified number of representative examples using the documented facility-location workflow.
Before you start
- Python environment with apricot-select installed from PyPI.
- A dataset available as an input array; the example uses NumPy.
Steps
Install the library with the command below.
pip install apricot-selectImport NumPy and
FacilityLocationSelection.Pass the dataset to
FacilityLocationSelectionwith the desired subset size, metric and optimizer, then callfit_transformto select and return the subset.
Expected outcome
A reduced dataset containing the requested number of selected examples; the README example selects 100 from 5,000 using Euclidean distance and the lazy optimizer.
Guide limitations
- Facility-location selection uses pairwise similarities; storing the full similarity matrix requires quadratic memory with the number of examples and may be impractical for large datasets.
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 11 November 2026
- Original website title
- jmschrei/apricot · Official homepage title · retained in its source language

