semvec/pypi-packages huggingface dataset:
bayeso-benchmarks 0.2.0
Benchmark functions for Bayesian optimization
License: MIT
Requires Python: >=3.7

<p align="center">
<img src="https://raw.githubusercontent.com/jungtaekkim/bayeso/main/docs/_static/assets/logo_bayeso_capitalized.svg" width="400" />
</p>

# BayesO Benchmarks: Benchmark Functions for Bayesian Optimization
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.7577330.svg)](https://doi.org/10.5281/zenodo.7577330)
[![Build Status](https://github.com/jungtaekkim/bayeso-benchmarks/actions/workflows/pytest.yml/badge.svg)](https://github.com/jungtaekkim/bayeso-benchmarks/actions/workflows/pytest.yml)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

This repository provides the implementation of benchmark functions for Bayesian optimization.
The details of benchmark functions can be found in [these notes](https://jungtaek.github.io/notes/benchmarks_bo.pdf).

* [https://bayeso.org](https://bayeso.org)

## Installation
We recommend installing it with `virtualenv`.
You can choose one of three installation options.

* Using PyPI repository (for user installation)

To install the released version in PyPI repository, command it.

```shell
pip install bayeso-benchmarks
```

* Using source code (for developer installation)

To install `bayeso-benchmarks` from source code, command the following in the `bayeso-benchmarks` root.

```shell
pip install .
```

* Using source code (for editable development mode)

To use editable development mode, command the following in the `bayeso-benchmarks` root.

```shell
pip install -e .
```

If you want to install the packages required for development, you can simply add `[dev]`.
For example, `pip install .[dev]` or `pip install -e .[dev]`.

* Uninstallation

If you would like to uninstall `bayeso-benchmarks`, command it.

```shell
pip uninstall bayeso-benchmarks
```

## Simple Example
A simple example on Branin function is shown below.
```python
from bayeso_benchmarks import Branin

obj_fun = Branin()
bounds = obj_fun.get_bounds()

X = obj_fun.sample_uniform(100)

Y = obj_fun.output(X)
Y_noise = obj_fun.output_gaussian_noise(X)
```

## Citation
```
@misc{KimJ2023software,
    author={Kim, Jungtaek},
    title={{BayesO Benchmarks}: Benchmark Functions for {Bayesian} Optimization},
    doi={10.5281/zenodo.7577330},
    url={https://github.com/jungtaekkim/bayeso-benchmarks},
    howpublished={\url{https://doi.org/10.5281/zenodo.7577330}},
    year={2023}
}
```

## License
[MIT License](LICENSE)
flwr-serverless 0.2.10
A serverless federated learning library based on flwr
License: MIT
Requires Python: >=3.6

A Flower ([flwr](https://flower.dev/)) extension for serverless federated learning.

Technical report (arXiv): [Serverless Federated Learning with `flwr-serverless`](https://arxiv.org/abs/2310.15329).

## Install

```
pip install flwr-serverless

or

pip install git+https://github.com/kungfuai/flwr_serverless.git
```

## Usage for tensorflow

- Step 1: Create federated `Node`s that use a shared folder to exchange model weights and use a federated strategy (`flwr.server.strategy.Strategy`) to control how the weights are aggregated.
- Step 2: Create and configure a callback `FlwrFederatedCallback` and use it in the `keras.Model.fit()`.

```python
# Create a FL Node that has a strategy and a shared folder.
from flwr.server.strategy import FedAvg  # This is a flwr federated strategy.
from flwr_serverless import AsyncFederatedNode, S3Folder
from flwr_serverless.keras import FlwrFederatedCallback

strategy = FedAvg()
shared_folder = S3Folder(directory="mybucket/experiment1")
node = AsyncFederatedNode(strategy=strategy, shared_folder=shared_folder)

# Create a keras Callback with the FL node.
num_examples_per_epoch = steps_per_epoch * batch_size # number of examples used in each epoch
callback = FlwrFederatedCallback(
    node,
    num_examples_per_epoch=num_examples_per_epoch,
    save_model_before_aggregation=False,
    save_model_after_aggregation=False,
)

# Join the federated learning, by fitting the model with the federated callback.
model = keras.Model(...)
model.compile(...)
model.fit(dataset, callbacks=[callback])
```

`flwr_serverless` uses `flwr_serverless.SharedFolder` to save model weights and metrics. The logic folder can be backed by a storage backend like S3.

The asynchronous FL node does not wait to sync with other nodes. It takes the latest
model weights from other nodes and performs the aggregation according to the specified strategy.

### Running experiments

To make it easier to experimemt with different strategies, we provide utility classes like `flwr.keras.example.FederatedLearningTestRun`. This allows you to configure the dataset partition, strategy and concurrency. Please use this as an example to develop your own experiments.

To reproduce some experiments reported in the paper, run

```
python -m experiments.experiment_scripts.exp1_mnist
python -m experiments.experiment_scripts.exp2_cifar10
python -m experiments.experiment_scripts.exp3_wikitext
```

Each of the above experiments run through a grid search over a large hyperparameter space,
with repeated trials using different random seeds. Please edit the script to adjust
the number of trials and the hyperparameter search space.