yaecs


Nameyaecs JSON
Version 6.0.5 PyPI version JSON
download
home_pageNone
SummaryA Config System designed for experimental purposes
upload_time2024-08-22 12:16:19
maintainerNone
docs_urlNone
authorReactive Reality AG
requires_python>=3.6
licenseNone
keywords template machine learning
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # YAECS (Yet Another Experiment Config System)

[![License](https://img.shields.io/badge/license-LGPLV3%2B-%23c4c2c2)](https://www.gnu.org/licenses/)

![GitHub last commit (branch)](https://img.shields.io/github/last-commit/valentingol/yaecs/main)
[![PyPI version](https://badge.fury.io/py/yaecs.svg)](https://badge.fury.io/py/yaecs)

[![Documentation Status](https://readthedocs.org/projects/yaecs/badge/?version=latest)](https://yaecs.readthedocs.io/en/latest/?badge=latest)

---

## Documentation: [here](https://yaecs.readthedocs.io/en/stable/)

This package is a Config System which allows easy manipulation of config files for safe, clear and repeatable
experiments. In a few words, it is:

- built for Machine Learning with its constraints in mind, but also usable out-of-the-box for other kinds of projects ;
- built with scalability in mind and can adapt just as easily to large projects investigating hundreds of well-organised
parameters across many experiments ;
- designed to encourage good coding practices for research purposes, and if used rigorously will ensure a number of
highly desirable properties such that **maintenance-less forward-compatibility** of old configs, **easy
reproducibility** of any experiment, and **extreme clarity** of former experiments for your future self or
collaborators.

[LINK TO DOCUMENTATION](https://github.com/valentingol/yaecs/blob/main/DOCUMENTATION_WIP.md)

## Installation

The package can be installed from pipy:

```bash
pip install yaecs
```

## Getting started

Getting started with using YAECS requires a single thing : creating a Configuration object containing your parameters.
There are many ways to create this config object, but let us focus on the easiest one.

```python
from yaecs import make_config

dictionary = {
    "batch_size": 32,
    "experiment_name": "overfit",
    "learning_rate": 0.001
}
config = make_config(dictionary)
```

And there you go, you have a config. You can query it using usual dictionary or object attribute getters such as :

```python
print(config.batch_size)  # 32
print(config["experiment_name"])  # overfit
print(config.get("learning_rate", None))  # 0.001
```

At this point you might think that this is nothing more than a more fancy dictionary... and you'd be right, that's
actually a very good way to think about your config. In fact, because it mostly behaves like a dictionary, it is much
easier to integrate into existing code or libraries which expect dictionaries.

Of course, in many situations, it is much more than a simple dictionary, as we demonstrate thoughout our
documentation. In this first introduction, we will cover two more things : loading a config from a **yaml file**, and
some basic **command line interaction**. If you want more, we encourage you to keep reading our other tutorials in
which we give **practical tips** and **best practices** for the management of your config over the course of a project.

The main purpose of using a config system is to manage your parameters more easily by **getting them out of your code**.
So let's do just that :)

We will create a file called `config.yaml` in the root of our project, next to our `main.py` :

```yaml
batch_size: 32
experiment_name: overfit
learning_rate: 0.001
```

Then, in your `main.py`, all you need to do is use the path to the file instead of the dictionary :

```python
from yaecs import make_config

config = make_config("config.yaml")

print(config.batch_size)
print(config["experiment_name"])
print(config.get("learning_rate", None))
```

Now, if you run your script, you should see the same prints as before.

```bash
$ python main.py
[CONFIG] Building config from default : config
32
overfit
0.001
```

One way the YAECS config system provides to manage parameters is to edit them from the command line, which is performed
automatically when you create your config. See for yourself :

```bash
$ python main.py --batch_size 16
[CONFIG] Building config from default : config
[CONFIG] Merging from command line : {'batch_size': 16}
16
overfit
0.001
$ python main.py --experiment_name=production --batch_size=16
[CONFIG] Building config from default : config
[CONFIG] Merging from command line : {'experiment_name': 'production', 'batch_size': 16}
16
production
0.001
```

The YAECS command line parser, one of YAECS' many ways of **preparing your experiment's config**, is very flexible and
fast when you want to change only a handful of parameters.

This is as far as we go for this short introduction. If you're already used to config systems and managing config files,
this might be enough to get you started. However, if you've always just used hardcoded values in your code, and maybe
argparse, you might not really know where to start. We advise you to look at our tutorial (in DOCUMENTATION_WIP.md), which will walk you
through config management using YAECS from early set-up to advanced usage.

Happy experimenting !

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "yaecs",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": "template, machine, learning",
    "author": "Reactive Reality AG",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/ec/98/71ae434a27d66aa9193f2bf488b58bf9e8891df5a8cc19d7057a2055ac70/yaecs-6.0.5.tar.gz",
    "platform": null,
    "description": "# YAECS (Yet Another Experiment Config System)\n\n[![License](https://img.shields.io/badge/license-LGPLV3%2B-%23c4c2c2)](https://www.gnu.org/licenses/)\n\n![GitHub last commit (branch)](https://img.shields.io/github/last-commit/valentingol/yaecs/main)\n[![PyPI version](https://badge.fury.io/py/yaecs.svg)](https://badge.fury.io/py/yaecs)\n\n[![Documentation Status](https://readthedocs.org/projects/yaecs/badge/?version=latest)](https://yaecs.readthedocs.io/en/latest/?badge=latest)\n\n---\n\n## Documentation: [here](https://yaecs.readthedocs.io/en/stable/)\n\nThis package is a Config System which allows easy manipulation of config files for safe, clear and repeatable\nexperiments. In a few words, it is:\n\n- built for Machine Learning with its constraints in mind, but also usable out-of-the-box for other kinds of projects ;\n- built with scalability in mind and can adapt just as easily to large projects investigating hundreds of well-organised\nparameters across many experiments ;\n- designed to encourage good coding practices for research purposes, and if used rigorously will ensure a number of\nhighly desirable properties such that **maintenance-less forward-compatibility** of old configs, **easy\nreproducibility** of any experiment, and **extreme clarity** of former experiments for your future self or\ncollaborators.\n\n[LINK TO DOCUMENTATION](https://github.com/valentingol/yaecs/blob/main/DOCUMENTATION_WIP.md)\n\n## Installation\n\nThe package can be installed from pipy:\n\n```bash\npip install yaecs\n```\n\n## Getting started\n\nGetting started with using YAECS requires a single thing : creating a Configuration object containing your parameters.\nThere are many ways to create this config object, but let us focus on the easiest one.\n\n```python\nfrom yaecs import make_config\n\ndictionary = {\n    \"batch_size\": 32,\n    \"experiment_name\": \"overfit\",\n    \"learning_rate\": 0.001\n}\nconfig = make_config(dictionary)\n```\n\nAnd there you go, you have a config. You can query it using usual dictionary or object attribute getters such as :\n\n```python\nprint(config.batch_size)  # 32\nprint(config[\"experiment_name\"])  # overfit\nprint(config.get(\"learning_rate\", None))  # 0.001\n```\n\nAt this point you might think that this is nothing more than a more fancy dictionary... and you'd be right, that's\nactually a very good way to think about your config. In fact, because it mostly behaves like a dictionary, it is much\neasier to integrate into existing code or libraries which expect dictionaries.\n\nOf course, in many situations, it is much more than a simple dictionary, as we demonstrate thoughout our\ndocumentation. In this first introduction, we will cover two more things : loading a config from a **yaml file**, and\nsome basic **command line interaction**. If you want more, we encourage you to keep reading our other tutorials in\nwhich we give **practical tips** and **best practices** for the management of your config over the course of a project.\n\nThe main purpose of using a config system is to manage your parameters more easily by **getting them out of your code**.\nSo let's do just that :)\n\nWe will create a file called `config.yaml` in the root of our project, next to our `main.py` :\n\n```yaml\nbatch_size: 32\nexperiment_name: overfit\nlearning_rate: 0.001\n```\n\nThen, in your `main.py`, all you need to do is use the path to the file instead of the dictionary :\n\n```python\nfrom yaecs import make_config\n\nconfig = make_config(\"config.yaml\")\n\nprint(config.batch_size)\nprint(config[\"experiment_name\"])\nprint(config.get(\"learning_rate\", None))\n```\n\nNow, if you run your script, you should see the same prints as before.\n\n```bash\n$ python main.py\n[CONFIG] Building config from default : config\n32\noverfit\n0.001\n```\n\nOne way the YAECS config system provides to manage parameters is to edit them from the command line, which is performed\nautomatically when you create your config. See for yourself :\n\n```bash\n$ python main.py --batch_size 16\n[CONFIG] Building config from default : config\n[CONFIG] Merging from command line : {'batch_size': 16}\n16\noverfit\n0.001\n$ python main.py --experiment_name=production --batch_size=16\n[CONFIG] Building config from default : config\n[CONFIG] Merging from command line : {'experiment_name': 'production', 'batch_size': 16}\n16\nproduction\n0.001\n```\n\nThe YAECS command line parser, one of YAECS' many ways of **preparing your experiment's config**, is very flexible and\nfast when you want to change only a handful of parameters.\n\nThis is as far as we go for this short introduction. If you're already used to config systems and managing config files,\nthis might be enough to get you started. However, if you've always just used hardcoded values in your code, and maybe\nargparse, you might not really know where to start. We advise you to look at our tutorial (in DOCUMENTATION_WIP.md), which will walk you\nthrough config management using YAECS from early set-up to advanced usage.\n\nHappy experimenting !\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A Config System designed for experimental purposes",
    "version": "6.0.5",
    "project_urls": {
        "Source": "https://gitlab.com/reactivereality/public/yaecs"
    },
    "split_keywords": [
        "template",
        " machine",
        " learning"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5633c2506bc28f06ded0d99eebe84f8c011cea145a80f4c6b6dfa61254bda916",
                "md5": "8b4badf381f87b78d6c9d7f1a46b413c",
                "sha256": "0fdfe10c1eb0ffad473b19330d5b9f3d0da4e64b6a7da942622e7df8fa6939d6"
            },
            "downloads": -1,
            "filename": "yaecs-6.0.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8b4badf381f87b78d6c9d7f1a46b413c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 110325,
            "upload_time": "2024-08-22T12:16:18",
            "upload_time_iso_8601": "2024-08-22T12:16:18.757687Z",
            "url": "https://files.pythonhosted.org/packages/56/33/c2506bc28f06ded0d99eebe84f8c011cea145a80f4c6b6dfa61254bda916/yaecs-6.0.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ec9871ae434a27d66aa9193f2bf488b58bf9e8891df5a8cc19d7057a2055ac70",
                "md5": "da099445fffec1de7dfe95e30c7a4ee8",
                "sha256": "476d0846a110267efb2dbd784403450868d26f8be4014846b909172c5ad446ee"
            },
            "downloads": -1,
            "filename": "yaecs-6.0.5.tar.gz",
            "has_sig": false,
            "md5_digest": "da099445fffec1de7dfe95e30c7a4ee8",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 317053,
            "upload_time": "2024-08-22T12:16:19",
            "upload_time_iso_8601": "2024-08-22T12:16:19.814341Z",
            "url": "https://files.pythonhosted.org/packages/ec/98/71ae434a27d66aa9193f2bf488b58bf9e8891df5a8cc19d7057a2055ac70/yaecs-6.0.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-22 12:16:19",
    "github": false,
    "gitlab": true,
    "bitbucket": false,
    "codeberg": false,
    "gitlab_user": "reactivereality",
    "gitlab_project": "public",
    "lcname": "yaecs"
}
        
Elapsed time: 0.43393s