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.1.tar.gz (12.2 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.1-py3-none-any.whl (18.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for polaris-py-0.6.1.tar.gz
Algorithm Hash digest
SHA256 eaef387dc54e97c194725d1981122f64a2d1d58ee3fedcba0ea95559a5037b8f
MD5 a6d697a1da62ae040710e099b7c999ca
BLAKE2b-256 80db81926e32c64029d065925091215aba410a0e8e506e7b3a4ffc6b5430514f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polaris_py-0.6.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e78ed80d36b2d50ad53083a5b32b6396872bbd9c57dcadcc815c305f5cbd204d
MD5 7bf8423497c8fb570afbcf5e3eff38fa
BLAKE2b-256 b0d3d092270e7fe49fbb697dae8c83a67bfedbe05e31e1ddf40dd077ba0b44ee

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