Skip to main content

Polaris is a hyperparamter optimization library.

Project description

# Polaris : Hyperparamter optimization library.

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

Polaris is a hyperparamter optimization library.
We plan to support every state-of-art tuning method as follows.

- Random Search
- Bayesian Optimization
- Tree-structured Parzen Estimators (TPE)

## Documentation
Polaris' documentation can be found at [https://polaris.readthedocs.io/](https://polaris.readthedocs.io/)

## Prerequisites
- Python >= 3.6
- RabbitMQ (Only for parallel execution)

## Installation

```shell
$ pip install polaris-py
```

## Examples

### Sequential Execution

```python
from polaris import Polaris, STATUS_SUCCESS, Trials, Bounds


def pseudo_train(params, exp_info):
lr_squared = (params['lr'] - 0.006) ** 2
weight_decay_squared = (params['weight_decay'] - 0.02) ** 2
loss = lr_squared + weight_decay_squared
return {
'loss': loss,
'status': STATUS_SUCCESS,
}


if __name__ == '__main__':
bounds = [
Bounds('lr', 0.001, 0.01),
Bounds('weight_decay', 0.0002, 0.04),
]
trials = Trials()
polaris = Polaris(
pseudo_train, bounds, 'bayesian_opt',
trials, max_evals=100, exp_key='this_is_test')
best_params = polaris.run()
print(best_params)
```

### Parallel Execution

#### Single Process

1. Run `rabbitmq-server`
1. Set `RABBITMQ_URL` (ampq://guest:guest@localhost//)
1. Run `polaris-worker --exp-key this_is_test`
1. Run codes as follows

### Multiple Processes (Use MPI)

1. Run `rabbitmq-server`
1. Set `RABBITMQ_URL` (ampq://guest:guest@localhost//)
1. Run `mpirun -n 4 polaris-worker --mpi --exp-key this_is_test`
1. Run codes as follows


```python

...

if __name__ == '__main__':
bounds = [
Bounds('lr', 0.001, 0.01),
Bounds('weight_decay', 0.0002, 0.04),
]
trials = Trials()
polaris = Polaris(
pseudo_train, bounds, 'bayesian_opt',
trials, max_evals=100, exp_key='this_is_test')
best_params = polaris.run_parallel()
print(best_params)
```


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

polaris-py-0.6.5.tar.gz (12.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

polaris_py-0.6.5-py3-none-any.whl (18.6 kB view details)

Uploaded Python 3

File details

Details for the file polaris-py-0.6.5.tar.gz.

File metadata

  • Download URL: polaris-py-0.6.5.tar.gz
  • Upload date:
  • Size: 12.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for polaris-py-0.6.5.tar.gz
Algorithm Hash digest
SHA256 a5bc02190a019cb828e0eb28810b63977c7a220aef57f67fd19c3e7aa0c26fb3
MD5 d72f986773eaaf6592365ef0853f613a
BLAKE2b-256 dd83144f8517292528a103c0419850f464e156f172ab16ed54768057a577ba15

See more details on using hashes here.

File details

Details for the file polaris_py-0.6.5-py3-none-any.whl.

File metadata

File hashes

Hashes for polaris_py-0.6.5-py3-none-any.whl
Algorithm Hash digest
SHA256 33e9016853ad128e3ddd790cb74503586bdfe5d938552dd4fbdc538e8d380034
MD5 e7574649ce06b0384d698ef5056efea1
BLAKE2b-256 f047abf190c4cd6e33e3fe6c2c997e09448a1e5199911730eeee567ef0943dfd

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