MEMENTO
MEMENTO is a Python library for running computationally expensive experiments.
Running complex sets of machine learning experiments is challenging and time-consuming due to the lack of a unified framework.
This leaves researchers forced to spend time implementing necessary features such as parallelization, caching, and checkpointing themselves instead of focussing on their project.
To simplify the process, we introduce MEMENTO, a Python package that is designed to aid researchers and data scientists in the efficient management and execution of computationally intensive experiments.
MEMENTO has the capacity to streamline any experimental pipeline by providing a straightforward configuration matrix and the ability to concurrently run experiments across multiple threads.
If you need to run a large number of time-consuming experiments MEMENTO can help:
- Structure your configuration
- Parallelize experiments across CPUs
- Save and restore results
- Checkpoint in-progress experiments
- Send notifications when experiments fail or finish
Getting Started
MEMENTO is officially available on PyPl. To install the package:
Install
pip install memento-ml
The Configuration Matrix
The core of MEMENTO is a configuration matrix that describes the list of experiments you
want MEMENTO to run. This must contain a key parameters which is itself a dict, this describes
each paramter you want to vary for your experiments and their values.
As an example let's say you wanted to test a few simple linear classifiers on a number of image recognition datasets. You might write something like this:
Don't worry if you're not working on machine learning, this is just an example.
matrix = {
"parameters": {
"model": [
sklearn.svm.SVC,
sklearn.linear_model.Perceptron,
sklearn.linear_model.LogisticRegression
],
"dataset": ["imagenet", "mnist", "cifar10", "quickdraw"]
}
}
MEMENTO would then generate 12 configurations by taking the cartesian product of the
parameters.
Frequently you might also want to set some global configuration values, such as a regularization
parameter or potentially even change your preprocessing pipeline. In this case MEMENTO also
accepts a "settings" key. These settings apply to all experiments and can be accessed from the
configuration list as well as individual configurations.
matrix = {
"parameters": ...,
"settings": {
"regularization": 1e-1,
"preprocessing": make_preprocessing_pipeline()
}
}
You can also exclude specific parameter configurations. Returning to our machine learning example, if you know SVCs perform poorly on cifar10 you might decide to skip that experiment entirely. This is done with the "exclude" key:
matrix = {
"parameters": ...,
"exclude": [
{"model": sklearn.svm.SVC, "dataset": "cifar10"}
]
}
Running an experiment
Along with a configuration matrix you need some code to run your experiments. This can be any
Callable such as a function, lambda, class, or class method.
from memento import Memento, Config, Context
def experiment(context: Context, config: Config):
classifier = config.model()
dataset = fetch_dataset(config.dataset)
classifier.fit(*dataset)
return classifier
Memento(experiment).run(matrix)
You can also perform a dry run to check you've gotten the matrix correct.
Memento(experiment).run(matrix, dry_run=True)
Running configurations:
{'model': sklearn.svm.SVC, 'dataset': 'imagenet'}
{'model': sklearn.svm.SVC, 'dataset': 'mnist'}
{'model': sklearn.svm.SVC, 'dataset': 'cifar10'}
{'model': sklearn.svm.SVC, 'dataset': 'quickdraw'}
{'model': sklearn.linear_model.Perceptron, 'dataset': 'imagenet'}
...
Exiting due to dry run
Code demo
- Code demo can be found here.
MEMENTOdoes not depend on any ML packages, e.g.,scikit-learn. Thescikit-learnandjupyterlabpackages are required to run the demo (./demo/*).
pip install memento-ml scikit-learn jupyterlab
Cite
If you find MEMENTO useful and use it in your research, please cite
Memento: Facilitating Effortless, Efficient, and Reliable ML Experiments - Z Pullar-Strecker, X Chang, L Brydon, I Ziogas, K Dost, J Wicker - Joint European Conference on Machine Learning and Knowledge Discovery in Databases, 2023 - Springer - https://link.springer.com/chapter/10.1007/978-3-031-43430-3_21
Roadmap
- Finish HPC support
- Improve result serialisation
- Improve customization for notification
Contributors
- Zac Pullar-Strecker
- Feras Albaroudi
- Liam Scott-Russell
- Joshua de Wet
- Nipun Jasti
- James Lamberton
- Xinglong (Luke) Chang
- Liam Brydon
- Ioannis Ziogas
- Katharina Dost
- Joerg Wicker
License
MEMENTO is licensed under the 3-Clause BSD License license.
Metadata
Release files for memento-ml 1.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| memento_ml-1.2.0.tar.gz | 28.2 kB | Without provenance | Details for memento_ml-1.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| memento_ml-1.2.0-py3-none-any.whl | Python 3 | none | any | Details for memento_ml-1.2.0-py3-none-any.whl |
Total release size: 49.6 kB
Release files / memento_ml-1.2.0.tar.gz
| Download URL | memento_ml-1.2.0.tar.gz |
|---|---|
| Size | 28.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6ad579f831acc4a656c7fd316c892f4aa15708a4a7789cd280da6511f8aa436f
|
|
BLAKE2b-256 checksum How to use checksums |
52e0cac895c320758ca1684c989453591447458e32877c1da88750a381c6722e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.9
|
Release files / memento_ml-1.2.0-py3-none-any.whl
| Download URL | memento_ml-1.2.0-py3-none-any.whl |
|---|---|
| Size | 21.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
030f155a27d0e8ea21c8d6ef662ee4b3832a563ebe7f7a3de458ce54a4850daa
|
|
BLAKE2b-256 checksum How to use checksums |
1ea510530318b39e5bcdad7ca66b5c7ea33c047085a373f55d2dfd8386bbe3f2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.9
|
Security for memento-ml 1.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.