Nelder-Mead for numerical optimization in Python
Project description
# neldermead
Nelder-Mead implementation
[![CircleCI](https://circleci.com/gh/nmasahiro/neldermead.svg?style=shield)](https://circleci.com/gh/nmasahiro/neldermead)
## Getting Started
### Prerequisites
You need only [NumPy](http://www.numpy.org/) that is the package for scientific computing.
### Installing
Please run the following command.
```bash
$ pip install neldermead
```
## Example
This is a simple example that objective function is sphere function.
```python
import numpy as np
from neldermead import NelderMead
dim = 3
f = lambda x: np.sum(x**2)
simplex = np.zeros([dim, dim + 1])
for i in range(dim + 1):
simplex[:, i] = np.array([np.random.rand() for _ in range(dim)])
nm = NelderMead(dim, f, simplex)
x_best, f_best = nm.optimize(100)
print("x_best:{}, f_best:{}".format(x_best, f_best))
#x_best:[[-1.48045204e-08]
# [-1.80962770e-08]
# [ 5.08040874e-08]], f_best:3.1277043680572982e-15
```
## Versioning
We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/nmasahiro/neldermead/tags).
## License
This project is licensed under the MIT License - see the [LICENSE](https://github.com/nmasahiro/neldermead/blob/master/LISENCE) file for details
Nelder-Mead implementation
[![CircleCI](https://circleci.com/gh/nmasahiro/neldermead.svg?style=shield)](https://circleci.com/gh/nmasahiro/neldermead)
## Getting Started
### Prerequisites
You need only [NumPy](http://www.numpy.org/) that is the package for scientific computing.
### Installing
Please run the following command.
```bash
$ pip install neldermead
```
## Example
This is a simple example that objective function is sphere function.
```python
import numpy as np
from neldermead import NelderMead
dim = 3
f = lambda x: np.sum(x**2)
simplex = np.zeros([dim, dim + 1])
for i in range(dim + 1):
simplex[:, i] = np.array([np.random.rand() for _ in range(dim)])
nm = NelderMead(dim, f, simplex)
x_best, f_best = nm.optimize(100)
print("x_best:{}, f_best:{}".format(x_best, f_best))
#x_best:[[-1.48045204e-08]
# [-1.80962770e-08]
# [ 5.08040874e-08]], f_best:3.1277043680572982e-15
```
## Versioning
We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/nmasahiro/neldermead/tags).
## License
This project is licensed under the MIT License - see the [LICENSE](https://github.com/nmasahiro/neldermead/blob/master/LISENCE) file for details
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
neldermead-0.0.12.tar.gz
(3.1 kB
view details)
Built Distribution
File details
Details for the file neldermead-0.0.12.tar.gz
.
File metadata
- Download URL: neldermead-0.0.12.tar.gz
- Upload date:
- Size: 3.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/2.7.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5f911466441f9720042a44cfe3f1a5e859bf18cd80904fc1f93f49464baba66a |
|
MD5 | ce06e64d77d30efcc9c9855addc760b0 |
|
BLAKE2b-256 | ceb568b0712c4a731493b0aa0a54c23fe97253ca14201944853065912b9c7ad5 |
File details
Details for the file neldermead-0.0.12-py3-none-any.whl
.
File metadata
- Download URL: neldermead-0.0.12-py3-none-any.whl
- Upload date:
- Size: 3.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/2.7.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3c423b188ad0149c97fd6b0abf268d7bc8998e154982edb243e3bedfd3743550 |
|
MD5 | bf7f9623eee8ccd21a62054444b69479 |
|
BLAKE2b-256 | db566677abc6d4d561b17a0e4dbc250708f0a35653898ee741dab5302082feab |