Giter Club home page Giter Club logo

peu's Introduction

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

peu's People

Contributors

bandoos avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.