Skip to main content

Exemplar Sample Selection Framework

A flexible framework for experimenting with and evaluating different sample selection strategies. This framework allows you to:

  • Compare different selection strategies
  • Evaluate using multiple metrics
  • Work with various datasets
  • Extend with custom strategies and metrics

Installation

  1. Clone the repository:
git clone https://github.com/yourusername/exemplar-sample-selection.git
cd exemplar-sample-selection
  1. Install dependencies using Poetry:
# Install Poetry if you haven't already:
# curl -sSL https://install.python-poetry.org | python3 -

# Install dependencies and create virtual environment
poetry install
  1. Activate the virtual environment:
poetry shell

Quick Start

Run the example experiment:

python examples/run_experiment.py

This will:

  1. Load the IMDB dataset
  2. Extract features using a sentence transformer
  3. Run random selection (baseline strategy)
  4. Evaluate using coverage metrics
  5. Save results to outputs/imdb_random/

Framework Structure

exemplar-sample-selection/
├── src/
│   ├── data/              # Dataset handling
│   ├── selection/         # Selection strategies
│   ├── metrics/           # Evaluation metrics
│   ├── experiments/       # Experiment management
│   └── utils/             # Utilities
├── tests/                 # Unit tests
├── configs/               # Experiment configs
├── examples/              # Example scripts
└── docs/                  # Documentation

Core Components

1. Dataset Management

  • Standardized dataset interface
  • Built-in support for text datasets
  • Feature extraction and caching
  • Easy extension to other data types

2. Selection Strategies

  • Base strategy interface
  • Random selection baseline
  • Support for both supervised and unsupervised selection
  • Easy addition of new strategies

3. Evaluation Metrics

  • Coverage metrics
  • Distribution matching
  • Performance metrics
  • Extensible metric system

4. Experiment Management

  • Configuration-based setup
  • Automated logging
  • Result tracking
  • Reproducible experiments

Adding New Components

Adding a New Selection Strategy

  1. Create a new file in src/selection/:
from .base import SelectionStrategy

class MyStrategy(SelectionStrategy):
    def select(self, features, labels=None, n_samples=100):
        # Implement your selection logic here
        return selected_indices
  1. Register in src/selection/__init__.py

Adding a New Metric

  1. Create a new file in src/metrics/:
from .base import Metric

class MyMetric(Metric):
    def compute(self, selected_features, full_features, 
                selected_labels=None, full_labels=None):
        # Implement your metric computation here
        return {'my_metric': value}
  1. Register in src/metrics/__init__.py

Running Experiments

1. Create Configuration

from src.experiments import ExperimentConfig
from src.experiments.config import DatasetConfig, SelectionConfig, MetricConfig

config = ExperimentConfig(
    name="My Experiment",
    dataset=DatasetConfig(
        name="dataset_name",
        split="train"
    ),
    selection=SelectionConfig(
        name="strategy_name",
        params={"param1": value1},
        n_samples=1000
    ),
    metrics=[
        MetricConfig(
            name="metric_name",
            params={"param1": value1}
        )
    ]
)

2. Run Experiment

from src.experiments import ExperimentRunner

runner = ExperimentRunner(config)
results = runner.run()

3. Examine Results

Results are saved in the output directory:

  • config.json: Experiment configuration
  • results.json: Detailed results
  • summary.txt: Human-readable summary
  • experiment.log: Execution log

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

License

MIT License - see LICENSE file for details

Metadata

Release files for coreset 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for coreset 0.0.1
File Size Uploaded Provenance Actions
coreset-0.0.1.tar.gz 12.1 kB Without provenance Details for coreset-0.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for coreset 0.0.1
File Interpreter ABI Platform Actions
coreset-0.0.1-py3-none-any.whl Python 3 none any Details for coreset-0.0.1-py3-none-any.whl

Total release size: 28.6 kB

Release files / coreset-0.0.1.tar.gz

Download URL coreset-0.0.1.tar.gz
Size 12.1 kB
Tags Source
SHA-256 checksum
How to use checksums
6e803a1baf065314ea930013f13cc2836a8fba3badaa5e2d2ee30ebe500f6261
BLAKE2b-256 checksum
How to use checksums
858b186c7ab171c013885d0892948f439355da2641cb431a4ca4e929388ac6cc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.9.9

Release files / coreset-0.0.1-py3-none-any.whl

Download URL coreset-0.0.1-py3-none-any.whl
Size 16.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
83d4cf8f805545c443c02eb0c9701c77156e432730e547ff7397680beb9ebe5a
BLAKE2b-256 checksum
How to use checksums
5fb2b4f554ccb5e5fe3b39a34ad895e4aa0d1fc88065e2d7e2005c5a80daf79e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.9.9

Security for coreset 0.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page