Skip to main content

Python experiment utils

Project description

peu

Python experiment utils

Utilities for software experimentation in python. Here I publish small utilities I recurrently use in experimental projects. This is also a pretext to publish my first package on PyPi.

This is a work in progress, and by now only includes a few meaningful functions.

  • peu.core:dict_product perfroming the a dictiionary flavoured cartesian product, useful to generate parameter combination for software experiments.

  • peu.multi:tracked_multproc_unordered perfroming application of function in parallel (via multiprocessing Pool) over a sequence of inputs, using tqdm to monitor progress

Examples

dict_product

from peu.core import dict_product

params = {'a': [1,2,3],
          'b': {True, False}}

fixed = {'max_epochs':100,
         'scoring': 'accuracy'}

configs = dict_product (params, fixed=fixed)

# =>
# [{'a': 1, 'b': False, 'max_epochs': 100, 'scoring': 'accuracy'},
#  {'a': 1, 'b': True, 'max_epochs': 100, 'scoring': 'accuracy'},
#  {'a': 2, 'b': False, 'max_epochs': 100, 'scoring': 'accuracy'},
#  {'a': 2, 'b': True, 'max_epochs': 100, 'scoring': 'accuracy'},
#  {'a': 3, 'b': False, 'max_epochs': 100, 'scoring': 'accuracy'},
#  {'a': 3, 'b': True, 'max_epochs': 100, 'scoring': 'accuracy'}]

tracked_multiproc_unordered

from peu.multi import tracked_multiproc_unordered
import time


def f(x):
    time.sleep(0.1)
    return (x + 1)**2

tracked_multiproc_unordered(f, range(100))

# 100%|████████████████████████████████████████████████████████████████| 100/100 [00:01<00:00, 76.71it/s]

Installation

The package is published on pypi @ https://pypi.org/project/peu-bandoos/0.0.2/

$ pip install peu-bandoos==0.0.2

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

peu-bandoos-0.0.2.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

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

peu_bandoos-0.0.2-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file peu-bandoos-0.0.2.tar.gz.

File metadata

  • Download URL: peu-bandoos-0.0.2.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.2

File hashes

Hashes for peu-bandoos-0.0.2.tar.gz
Algorithm Hash digest
SHA256 26dc2dfcbb5ccb05233d2b64145dee0ac8dd6e985a38912fc10d2a1ae371b88a
MD5 fbd5be5ac95a8fa8f3560a6d106911b4
BLAKE2b-256 068fe148bb47d26516d2ff877ffb265d8905c1a8a32169a6c0b4796ca0db5397

See more details on using hashes here.

File details

Details for the file peu_bandoos-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: peu_bandoos-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.2

File hashes

Hashes for peu_bandoos-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0a5b1c1d4fd00fe9381294ed5f5c21cb194033888926decc8ef1a4c3bcaddf78
MD5 1d5ffc475fe100c909ad509c3a3fdc88
BLAKE2b-256 dfdb6a8c9efd315b825df485c2f293c1969a32af7dda0a32d029c1fca8eeffae

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