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.0.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.0-py3-none-any.whl (2.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: glaux-0.1.0.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.0.tar.gz
Algorithm Hash digest
SHA256 e315512da1f511feb15808c6be35368a57a2496526f1e816c011763e3fc32523
MD5 165dada0bf6447fc7940384e9760d18a
BLAKE2b-256 e7cdb8ae4c74b77ec4c8be82f53c85069498b4cac14d617de0acc34760e2c674

See more details on using hashes here.

File details

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

File metadata

  • Download URL: glaux-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 2.2 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 431f7442d0456760fdb98df5e1efc1024b5668375ea790bc5597b707dd03e9f3
MD5 b17ee6e4ae3c8f729e6cd022c183ab6e
BLAKE2b-256 3ffc26abd6f1f5992985a755a5efb0f6dab61ef9f1a99c54c972549bab01862c

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