Skip to main content

Barycenter method in python

Project description

Version python downloads

Pybary

A sniffer optimizer

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:

pip install pybary

Minimal example

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

#!/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)

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

pybary-0.1.0.tar.gz (4.0 kB view hashes)

Uploaded Source

Built Distribution

pybary-0.1.0-py3-none-any.whl (3.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page