https://github.com/opendilab/digging
Decision Intelligence for digging best parameters in target environment.
https://github.com/opendilab/digging
bayesian-optimization evolutionary-algorithm reinforcement-learning searching
Last synced: 6 months ago
JSON representation
Decision Intelligence for digging best parameters in target environment.
- Host: GitHub
- URL: https://github.com/opendilab/digging
- Owner: opendilab
- License: apache-2.0
- Created: 2022-08-16T08:35:48.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2022-10-12T05:51:35.000Z (almost 3 years ago)
- Last Synced: 2023-11-07T17:25:16.392Z (almost 2 years ago)
- Topics: bayesian-optimization, evolutionary-algorithm, reinforcement-learning, searching
- Language: Python
- Homepage: https://opendilab.github.io/DIgging/main/index.html
- Size: 6.32 MB
- Stars: 102
- Watchers: 4
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# DIgging
[](https://twitter.com/opendilab)
[](https://github.com/opendilab/DIgging/actions/workflows/style.yml?query=workflow%3A%22Style+And+Badge%22)
[](https://github.com/opendilab/DIgging/actions/workflows/test.yml?query=workflow%3A%22Code+Test%22)
[](https://github.com/opendilab/DIgging/actions/workflows/doc.yml?query=workflow%3A%22Docs+Deploy%22)
[](https://github.com/opendilab/DIgging/actions/workflows/release.yml?query=workflow%3A%22Package+Release%22)[](https://pypi.org/project/digging/)
[](https://pypi.org/project/digging/)
[](https://app.codecov.io/gh/opendilab/digging)


[](https://github.com/opendilan/digging/stargazers)
[](https://github.com/opendilab/digging/network)

[](https://github.com/opendilab/digging/blob/master/LICENSE)DIgging -- Decision Intelligence for digging better parameters in target function/environments.
## Introduction
**DIgging** is a heuristic searching and optimization platform with various Decision Intelligence methods such as Genetic Algorithm, Bayesian Optimization and Reinforcement Learning etc. It can be used to digging better candidates to handle combinatorial optimization problems and non-gradient search problems.
**DIgging** is a fundamental platform under [**OpenDILab**](http://opendilab.org/) and it uses [**DI-engine**](https://github.com/opendilab/DI-engine) to build RL searching pipelines.
[Documentation](https://opendilab.github.io/DIgging/main/index.html)
## Outlines
- [DIgging](#digging)
- [Introduction](#introduction)
- [Outlines](#outlines)
- [Installation](#installation)
- [Quick start](#quick-start)
- [Digging Method Zoo](#digging-method-zoo)
- [License](#license)## Installation
You can simply install DIgging with `pip` command line from the official PyPI site.
```bash
pip install --user digging
python -c 'import digging'
```Or you can simply install it from the source code.
```bash
git clone git clone https://github.com/opendilab/DIgging.git
cd DIgging
pip install --user .
python -c 'import digging'
```It will automatically install **DI-engine** together with its requirement packages i.e. **PyTorch**.
## Quick start
**DIgging** defines core algorithm and searching methods as `Digger`. You can define a `Digger` with a searching `Space`,
and can be modified by a config dict.
**DIgging** provides two kinds of searching pipeline for a target function. Thet are listed as follow.1. Interactive Procedure
It is done by calling `Digger`'s `propose` and `update_score` method, in which you can flexibly define the searching
procedures. You can call the `provide_best` method at any time to see the currently best candidate sample and its score.
Here's an simple example:```python
def target_func(x):
...
return scorespace = YourSpace(shape=(...))
digger = YourDigger(config, space)for i in range(max_iterations):
samples = digger.propose(sample_num)
scores = [target_func(x) for x in samples]
digger.update_score(samples, scores)print(digger.provide_best())
```2. Functional Procedure
It is done by calling the `search` method of `Digger`, with target function provided as input. The digger will
automatically search the best samples of the target according to the config. Here's an example:```python
def target_func(x):
...
return scorespace = YourSpace(shape=(...))
digger = YourDigger(config, space)digger.search(target_func)
print(digger.provide_best())
```3. Reinforcement Learning Procedure
When using a Reinforcement Learning `Digger`, users need to provide an RL `Policy` defined in **DI-engine** form,
and some other RL workers in **DI-engine** such as `Collector`, `Learner`, `ReplayBuffer` are supposed to be used
in the `Digger`. In the searching procedure, a target `Env` is used instead of a function. So we suggest to use
the `search` method to if the user is not familiar with the RL pipeline of **DI-engine**. Here's an example.```python
def target_func(x):
...
return scorerl_config = EasyDict(dict(...))
space = YourSearchSpace(shape=(...))
policy = YourPolicy(rl_config.policy, ...)
digger = RLDigger(rl_cfg, space, policy)digger.search(target_func)
print(digger.provide_best())
```## Digging Method Zoo
- Genetic Algorithm
- Bayesian Optimization
- RL## Join and Contribute
We appreciate all contributions to improve DIgging, both algorithms and system designs. Welcome to OpenDILab community! Scan the QR code and add us on Wechat:Or you can contact us with [slack](https://opendilab.slack.com/join/shared_invite/zt-v9tmv4fp-nUBAQEH1_Kuyu_q4plBssQ#/shared-invite/email) or email (opendilab@pjlab.org.cn).
## License
**DIgging** is released under the Apache 2.0 license.