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.3.tar.gz (4.0 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.3-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: glaux-0.1.3.tar.gz
  • Upload date:
  • Size: 4.0 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.3.tar.gz
Algorithm Hash digest
SHA256 f4dbda1aaf837b9a152e4e2a8065215b1e8a249965c6b887548e2acf9fc83b1b
MD5 a9080577a16832d83dbf817ce1f0572f
BLAKE2b-256 0532d705010ba9df4d5ec53ec9ac70ecf4363c25336afb117332ec67b688b6c3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: glaux-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 4.0 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a0d352cc857cca84f7e597579f0b778f0d1f3064336e025f666c819122b217d6
MD5 54a79612a8d4f15821f84eb4f94981b3
BLAKE2b-256 ae08614db80b62441cb745b9add04ff3580efd8981e4b2f3728a23883ce28b60

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