Skip to main content
# 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)
```


Release files for polaris-py 0.7.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for polaris-py 0.7.3
File Size Uploaded
polaris-py-0.7.3.tar.gz 12.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for polaris-py 0.7.3
File Interpreter ABI Platform
polaris_py-0.7.3-py3-none-any.whl Python 3 none any Details

Total release size: 31.4 kB

Release files / polaris-py-0.7.3.tar.gz

Download URL polaris-py-0.7.3.tar.gz
Size 12.5 kB
Tags Source
SHA-256 checksum
How to use checksums
12cda01ff855237199afe56c7198b0c9766b4ee4bd41bbef9da7891967d94252
BLAKE2b-256 checksum
How to use checksums
04538a7f151272b10499a878e99e19f298bc92142e032b8e77b28cb7aeba91e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / polaris_py-0.7.3-py3-none-any.whl

Download URL polaris_py-0.7.3-py3-none-any.whl
Size 18.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
014bf35dd5bf875cadb1f9be11bc9c4c0e5c6410746cfc951087876a7f9dbce8
BLAKE2b-256 checksum
How to use checksums
e33cfadeb8ffedb26dda352f9cc59a7807b8dd322f89450d768cfaa0e3af48b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.7.3 This release

2 release files

0.7.2

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.5

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.3

2 release files

0.2

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page