Skip to main content

A personal library for saving experiment results

Project description

Glaux - A personal library for saving experiments results

Introduction

Welcome to Glaux, a library for saving the results of my experiments! Glaux is a personal library designed to store the results of my experiments during my PhD. The experiments I run always follow a 3-level design:

  • Level 1 - Experiment: This is the concept I want to test. It contains a set of hypotheses and a typical machine learning workflow..
  • Level 2 - Settings: As in any proper experiment, I need to test different hyperparameter configurations to see how they affect the results.
  • Level 3 - Trial: As in any proper experiment, I need to test different hyperparameter configurations to see how they affect the results.

Typically, for each hyperparameter configuration (settings), many trials are executed in order to compare them statistically. This is usually what an experiment consists of. Settings are typically represented as a collection of hyperparameters or metadata shared across a group of trials, while trials store the results, execution-specific metadata, and even full models if needed and if they are not too large.}

Usage

To create an experiment, the GlauxExp class is used. Settings and trials are stored as Python dictionaries. For settings, it is recommended that dictionaries contain only native Python types and NumPy arrays. Trials are more flexible and can store native types or custom class objects.

Example

Code:

# USE MODE:
import numpy as np

# Create a Glaux object
exp = GlauxExp(filename='test.pickle',description='Random number is less than a threshold')

# Create una configuration
thres = np.array([0.5, 0.1, 0.5, 0.9])

# Run the experiment
for _ in range(10):
    rnd_less = np.random.random(size=4) < thres
    exp.insert_trial( settings={'thres':thres}, 
                      trial={'result':rnd_less,'count':rnd_less.sum()} )
    
# Create a new configuration
thres = np.array([0.8, 0.8, 0.1, 0.1])

# Run the experiment again
for _ in range(10):
    rnd_less = np.random.random(size=4) < thres
    exp.insert_trial( settings={'thres':thres}, 
                      trial={'result':rnd_less} )


review_exp = GlauxExp(filename='test.pickle')
print( review_exp )

Output:

Random number is less than a threshold
id (0) | n_trials 10 | settings:{'thres': array([0.5, 0.1, 0.5, 0.9])}
id (1) | n_trials 10 | settings:{'thres': array([0.8, 0.8, 0.1, 0.1])}

Code:

# With GlauxExp().get_trial( id, keys ) you can access especific fields of the trials    
review_exp.get_trials(0, ['result','count'])

Output:

[[array([ True, False,  True,  True]), np.int64(3)],
 [array([False, False, False,  True]), np.int64(1)],
 [array([ True, False,  True,  True]), np.int64(3)],
 [array([ True, False, False,  True]), np.int64(2)],
 [array([False, False,  True,  True]), np.int64(2)],
 [array([False, False,  True,  True]), np.int64(2)],
 [array([ True, False, False,  True]), np.int64(2)],
 [array([False, False,  True,  True]), np.int64(2)],
 [array([ True, False, False, False]), np.int64(1)],
 [array([False, False,  True,  True]), np.int64(2)]]

Code:

# If keys are not especified, you access all the trials for that setting id
review_exp.get_trials(0)

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

glaux-0.1.1.tar.gz (2.4 kB view details)

Uploaded Source

Built Distribution

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

glaux-0.1.1-py3-none-any.whl (2.3 kB view details)

Uploaded Python 3

File details

Details for the file glaux-0.1.1.tar.gz.

File metadata

  • Download URL: glaux-0.1.1.tar.gz
  • Upload date:
  • Size: 2.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for glaux-0.1.1.tar.gz
Algorithm Hash digest
SHA256 5311f653fcdf9ecb4dbb44f86b9c0d4f01d4b48b405d2001ec7991551dbbf0bf
MD5 2a75792cde0f0e8494d5e6ce9b0527d2
BLAKE2b-256 3758a4a64716ecb127b876c5289cc063afb504ab2abbfa539f1580fdf823be6d

See more details on using hashes here.

File details

Details for the file glaux-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: glaux-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 2.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for glaux-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 262d7c851eb5e6258a34f7896f7472059deca6c1ebb32bc5e46831f085a04cd1
MD5 d6d02bd06611376ee8522a33d0fe20e4
BLAKE2b-256 794afb3c4c796db43066dd636ff8b5ee174d815534dfdc5b2e682dec004c0e8b

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