Metadata-Version: 2.1
Name: pybary
Version: 0.1.0
Summary: Barycenter method in python
Home-page: https://pypi.org/project/pybary/
License: MIT
Keywords: optimization,discrete
Author: Bruno Peixoto
Author-email: brunolnetto@gmail.com
Requires-Python: >=3.8.1,<3.12
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Intended Audience :: Education
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Scientific/Engineering
Requires-Dist: ipython (>=8.8.0,<9.0.0)
Requires-Dist: numpy (==1.19.5)
Requires-Dist: scipy (>=1.10.0,<2.0.0)
Project-URL: Repository, https://github.com/asmove/pybary
Description-Content-Type: text/markdown

[![Version](https://img.shields.io/pypi/v/pybary.svg)](https://pypi.python.org/pypi/pybary)
[![python](https://img.shields.io/pypi/pyversions/pybary.svg)](https://pypi.org/project/pybary/)
[![downloads](https://img.shields.io/pypi/dm/pybary)](https://pypi.org/project/pybary/)

Pybary
========

![A sniffer optimizer](https://github.com/asmove/pybary/blob/main/images/pybary-tiny.png?raw=true)

Barycenter method in python. Take a look at original article: https://arxiv.org/abs/1801.10533

How to install
----------------

We run the command on desired installation environment:

``` {.bash}
pip install pybary
```

Minimal example
----------------

We run command `python example.py` on the folder with file `example.py` and following content:

``` {.python}
#!/usr/bin/env python
from pybary import bary_batch, bary_recursive
from numpy import power, array
from numpy.random import normal

# Oracle function
oracle = lambda x: power(x, 2)

# Initial point
x0 = array([0, 0])

# Batch points for batch barycenter version
mu_x = 0
sigma_x = 1
size_x = [100, 2]

xs = normal(mu_x, sigma_x, size_x)

# Hyperparameters
nu = 10
sigma = 0.1
zeta = 0
lambda_ = 1
iterations = 100

# Recursive run
xhat_recursive = bary_recursive(
        oracle, x0, nu, sigma, zeta, lambda_, iterations
    )

# Batch run
xhat_batch = bary_batch(
        oracle, xs, nu, sigma
    )

# Results
print(xhat_batch)
print(xhat_recursive)
```

