Skip to main content

Package for managing research experiments text results.

Project description

ExpKit

ExpKit is a flexible experiment management framework for machine learning projects, providing easy storage, retrieval, and evaluation of experimental results.

Features

  • Multiple storage backends (Disk, Zip, Memory, Mongo)
  • Caching support with ROCache
  • Flexible metadata management
  • Batch processing of inputs/outputs
  • Evaluation metrics computation
  • Query interface for experiment retrieval

Installation

pip install expkit-core

Quick Start

Creating an Experiment

from expkit import Exp, DiskStorage

# Configure experiment metadata
meta = {
    "steps": 1000,
    "temperature": 0.7,
    "n": 5,
    "model_path": "path/to/model",
    "batch_size": 32,
}

# Create experiment with disk storage
experiment = Exp(
    storage=DiskStorage(save_path, "rw"),
    meta=meta
)

Adding Data

# Add input/output instances
experiment.add_instances(
    inputs=["input1", "input2", "input3"],
    outputs=["output1", "output2", "output3"]
)

# Add evaluation scores
experiment.add_eval("accuracy", [0.85, 0.92, 0.88])

Loading and Querying Experiments

from expkit import ZipStorage, ExpSetup

# Initialize storage
storage = ZipStorage(base_dir="path/to/outputs", mode="r")

# Create experiment setup
setup = ExpSetup(storage=storage)

# Query experiments
results = setup.query({
   "split":"test",
})

Working with Results

# Access experiment metadata
model_path = exp.get("model_path")

# Get instances
data = exp.instances()

# Get evaluation results
values = exp.get_eval(key)

Storage Backends

ExpKit supports multiple storage backends:

  • DiskStorage: Stores experiments as files on disk
  • ZipStorage: Stores experiments in zip archives
  • MongoStorage: Stores experiments in mongo server
  • MemoryStorage: Keeps experiments in memory
  • ROCache: Caching layer that can wrap other storage backends

Evaluation Operations

You can define custom evaluation operations:

setup = ExpSetup(
    storage=storage,
    ops={
        "mean-reward-1": EvalTotalMean(
            entry_key="scores",
            eval_key=eval_key,
            n=1
        )
    }
)

# Run evaluation operations
setup.run_ops()


# Access results
first_exp_reward = setup[0].get("mean-reward-1")

# Transform experiments
mapped_results = setup.map(lambda exp: {
    "reward": exp.get("mean-reward-1"),
    "model": exp.get("model_path")
})

# Filter experiments
filtered = setup.filter(lambda exp: exp.get("temperature") > 0.5)

# Sort experiments
sorted_exps = setup.sort("temperature")  # ascending order

Contributing

Contributions are welcome! Please read our contributing guidelines and submit pull requests to our repository.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

expkit_core-1.0.6.tar.gz (22.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

expkit_core-1.0.6-py3-none-any.whl (31.7 kB view details)

Uploaded Python 3

File details

Details for the file expkit_core-1.0.6.tar.gz.

File metadata

  • Download URL: expkit_core-1.0.6.tar.gz
  • Upload date:
  • Size: 22.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.15

File hashes

Hashes for expkit_core-1.0.6.tar.gz
Algorithm Hash digest
SHA256 74b040905d90f606fe4608cea66f5a458a0a21e8e91f183765491675ca321c92
MD5 245f31099886f91caf5431433be9da4c
BLAKE2b-256 4d0dfe4cc1beaac1f8f4ea5d0666a616e237e7f865a0d5858b91c2d5465e342d

See more details on using hashes here.

File details

Details for the file expkit_core-1.0.6-py3-none-any.whl.

File metadata

  • Download URL: expkit_core-1.0.6-py3-none-any.whl
  • Upload date:
  • Size: 31.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.15

File hashes

Hashes for expkit_core-1.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 485910136e74bc7f23916ea32e1cd1a506dae03a83136350f5e1950fe1acfa6c
MD5 1c472c3da97cf6b229496f51be1cb3d4
BLAKE2b-256 09a0faec586983d65a75f50bbb4c57d8857738cffe3a98fead409a4c536f311a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page