Skip to main content

PyPI version Conda Version test docs

neighpy

neighphy is a Python implementation of the Neighbourhood Algorithm for the optimisation and appraisal of high-dimensional loss surfaces. First presented in two papers by M. Sambridge at the Australian National University in 1999, it has since been widely used, particularly in the geophysical community, for the optimisation of complex, high-dimensional functions.

This implementation hopes to replace the original Fortran code with a more modern, user-friendly and flexible Python package. It is a very simple implementation, with just two classes to implement the two phases of the algorithm: the neighpy.search.NASearcher class for the optimisation phase, and the neighpy.appraise.NAAppraiser class for the appraisal phase

Installation

pip install neighpy

Basic Usage

import numpy as np
from neighpy import NASearcher, NAAppraiser

def objective(x):
    # Objective function to be minimised
    return np.linalg.norm(data - predict_data(x))

# Bounds of the parameter space
bounds = ((-5, 5), (-5, 5))

# Initialise direct search phase
searcher = NASearcher(
    objective,
    ns=100, # number of samples per iteration
    nr=10, # number of cells to resample
    ni=100, # size of initial random search
    n=20, # number of iterations
    bounds=bounds
)

# Run the direct search phase
searcher.run() # results stored in searcher.samples and searcher.objectives

# Initialise the appraisal phase
appraiser = NAAppraiser(
    searcher.samples, # points of parameter space already sampled
    np.exp(-searcher.objectives), # objective function values (as a probability distribution)
    bounds=bounds,
    n_resample=500000, # number of desired new samples
    n_walkers=10 # number of parallel walkers
)

# Run the appraisal phase
appraiser.run()  # Results stored in appraiser.samples

Licence

This code is distributed under a GNU General Public License.

Contributing

If you have any questions, please to open an issue in this repository.

Metadata

Release files for neighpy 0.2.0

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

Source distribution (sdist)

Source distribution for neighpy 0.2.0
File Size Uploaded Provenance Actions
neighpy-0.2.0.tar.gz 21.2 kB Without provenance Details for neighpy-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for neighpy 0.2.0
File Interpreter ABI Platform Actions
neighpy-0.2.0-py3-none-any.whl Python 3 none any Details for neighpy-0.2.0-py3-none-any.whl

Total release size: 43.5 kB

Release files / neighpy-0.2.0.tar.gz

Download URL neighpy-0.2.0.tar.gz
Size 21.2 kB
Tags Source
SHA-256 checksum
How to use checksums
ccb808279cdb08e161704446b730fc53c0ae8b3b73ddfeb6d23f939c3e7051e2
BLAKE2b-256 checksum
How to use checksums
d8abeef0d0db4d4a94de3ae6f39c4915c553259a9766a162ad488218af8ddf18
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.1 CPython/3.14.4 Linux/7.0.0-1017-azure

Release files / neighpy-0.2.0-py3-none-any.whl

Download URL neighpy-0.2.0-py3-none-any.whl
Size 22.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9b3ba149f1cc7ef437aa93b24eca8019869ce45815f851254d18e9e269766494
BLAKE2b-256 checksum
How to use checksums
2f3cc8eb9274baed468f74cf45a2240f2b165c0d363596d9acfd95af77615d23
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.1 CPython/3.14.4 Linux/7.0.0-1017-azure

Security for neighpy 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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