breedgym


Namebreedgym JSON
Version 0.0.2a0 PyPI version JSON
download
home_pageNone
SummarySuite of Gymnasium environments for optimizing breeding programs
upload_time2024-05-26 18:11:18
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseBSD-3-Clause
keywords reinforcement learning breeding genetics bioinformatics
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # BreedGym

## Installation

Using pip:
```bash
pip install breedgym
```

From source:
```bash
git clone https://github.com/younik/breedgym
cd breedgym
pip install -e .
```

## Quickstart

BreedGym environments implement the [Gymnasium](https://gymnasium.farama.org) API, making it easy to use it with your preferred learning library.

```python
import gymnasium as gym
import numpy as np

env = gym.make(
    "breedgym:BreedGym",
    genetic_map="path/to/genetic_map.txt",
    initial_population="path/to/geno.npy",
    num_generations=10
)
print("Observation space:", env.observation_space)
print("Action space:", env.action_space)
```
To test, you can use the sample data we provide [here](https://github.com/younik/breedgym/tree/main/breedgym/data). In the case of the small sample data, we have 370 initial population members with 10k markers. 

```
Observation space: Box(False, True, (370, 10000, 2), bool)
Action space: Sequence(Tuple(Discrete(370), Discrete(370)), stack=False)
```

After initializing the environment, we can interact with it as a standard Gymnasium environment:

```python
initial_pop, info = env.reset()
tru = False
for gen_number in range(10):
    assert not tru
    act = env.action_space.sample()
    pop, rew, ter, tru, infos = env.step(np.asarray(act))
```

After 10 generations, we expect the environment to truncate, as we specified 10 generations horizon during environment initialization:

```python
assert tru
print("Reward (GEBV mean):", rew)
```

The full list of environments can be found [here](https://github.com/younik/breedgym/blob/main/breedgym/__init__.py).

## Citing

```
@inproceedings{younis2023breeding,
  title={Breeding Programs Optimization with Reinforcement Learning},
  author={Younis, Omar G. and Corinzia, Luca and Athanasiadis, Ioannis N and Krause, Andreas and Buhmann, Joachim  and Turchetta, Matteo},
  booktitle={NeurIPS 2023 Workshop on Tackling Climate Change with Machine Learning},
  url={https://www.climatechange.ai/papers/neurips2023/93},
  year={2023}
}
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "breedgym",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "Reinforcement Learning, Breeding, genetics, bioinformatics",
    "author": null,
    "author_email": "\"Omar G. Younis\" <omar.g.younis@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/24/72/ef5d12cb412e3004fc36a43dbcc9149c427e8c6eed8bc6c9499baa41bccc/breedgym-0.0.2a0.tar.gz",
    "platform": null,
    "description": "# BreedGym\n\n## Installation\n\nUsing pip:\n```bash\npip install breedgym\n```\n\nFrom source:\n```bash\ngit clone https://github.com/younik/breedgym\ncd breedgym\npip install -e .\n```\n\n## Quickstart\n\nBreedGym environments implement the [Gymnasium](https://gymnasium.farama.org) API, making it easy to use it with your preferred learning library.\n\n```python\nimport gymnasium as gym\nimport numpy as np\n\nenv = gym.make(\n    \"breedgym:BreedGym\",\n    genetic_map=\"path/to/genetic_map.txt\",\n    initial_population=\"path/to/geno.npy\",\n    num_generations=10\n)\nprint(\"Observation space:\", env.observation_space)\nprint(\"Action space:\", env.action_space)\n```\nTo test, you can use the sample data we provide [here](https://github.com/younik/breedgym/tree/main/breedgym/data). In the case of the small sample data, we have 370 initial population members with 10k markers. \n\n```\nObservation space: Box(False, True, (370, 10000, 2), bool)\nAction space: Sequence(Tuple(Discrete(370), Discrete(370)), stack=False)\n```\n\nAfter initializing the environment, we can interact with it as a standard Gymnasium environment:\n\n```python\ninitial_pop, info = env.reset()\ntru = False\nfor gen_number in range(10):\n    assert not tru\n    act = env.action_space.sample()\n    pop, rew, ter, tru, infos = env.step(np.asarray(act))\n```\n\nAfter 10 generations, we expect the environment to truncate, as we specified 10 generations horizon during environment initialization:\n\n```python\nassert tru\nprint(\"Reward (GEBV mean):\", rew)\n```\n\nThe full list of environments can be found [here](https://github.com/younik/breedgym/blob/main/breedgym/__init__.py).\n\n## Citing\n\n```\n@inproceedings{younis2023breeding,\n  title={Breeding Programs Optimization with Reinforcement Learning},\n  author={Younis, Omar G. and Corinzia, Luca and Athanasiadis, Ioannis N and Krause, Andreas and Buhmann, Joachim  and Turchetta, Matteo},\n  booktitle={NeurIPS 2023 Workshop on Tackling Climate Change with Machine Learning},\n  url={https://www.climatechange.ai/papers/neurips2023/93},\n  year={2023}\n}\n```\n",
    "bugtrack_url": null,
    "license": "BSD-3-Clause",
    "summary": "Suite of Gymnasium environments for optimizing breeding programs",
    "version": "0.0.2a0",
    "project_urls": {
        "Bug Report": "https://github.com/younik/breedgym/issues",
        "Repository": "https://github.com/younik/breedgym"
    },
    "split_keywords": [
        "reinforcement learning",
        " breeding",
        " genetics",
        " bioinformatics"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "49358bd8c67219f860c1ceacc3d5238e9c382801778a474ffa1fa3c4efb19282",
                "md5": "9b5806283a0276d33dc508ef17587875",
                "sha256": "23faabaf12e0a376d3b98d538da11af1499afc79cef835d3951c3147f65f4895"
            },
            "downloads": -1,
            "filename": "breedgym-0.0.2a0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9b5806283a0276d33dc508ef17587875",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 652057,
            "upload_time": "2024-05-26T18:11:15",
            "upload_time_iso_8601": "2024-05-26T18:11:15.123456Z",
            "url": "https://files.pythonhosted.org/packages/49/35/8bd8c67219f860c1ceacc3d5238e9c382801778a474ffa1fa3c4efb19282/breedgym-0.0.2a0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2472ef5d12cb412e3004fc36a43dbcc9149c427e8c6eed8bc6c9499baa41bccc",
                "md5": "1f5ec916e760ee5b794b8294d6e48c6c",
                "sha256": "db16261de673c1fb68556f49e4feef892ad3b894d2363c7f6450dd3de722dbd2"
            },
            "downloads": -1,
            "filename": "breedgym-0.0.2a0.tar.gz",
            "has_sig": false,
            "md5_digest": "1f5ec916e760ee5b794b8294d6e48c6c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 562175,
            "upload_time": "2024-05-26T18:11:18",
            "upload_time_iso_8601": "2024-05-26T18:11:18.630716Z",
            "url": "https://files.pythonhosted.org/packages/24/72/ef5d12cb412e3004fc36a43dbcc9149c427e8c6eed8bc6c9499baa41bccc/breedgym-0.0.2a0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-26 18:11:18",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "younik",
    "github_project": "breedgym",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "breedgym"
}
        
Elapsed time: 0.24541s