Skip to main content

Multipurpose interpolation library focussing on RBF, written in rust.

Project description

PyHolo

Build & Test License: MIT

Python bindings for flexible interpolation library featuring Radial Basis Function (RBF) written in rust. It features:

  • RBF interpolation with many kernels to choose from.
  • Flexible Data Types: Supports input and output datasets of type float, list[float], ndarray.

Installation

pip install pyholo

For optimal performance, it's recommended to use a virtual environment.

Quick Start

1D Interpolation of a target function

import numpy as np
import pyholo as holo

def target_function(pts):
    return 10.0 + np.sum(
        np.power(pts, 2) + 10.0 * np.cos(2.0 * np.pi * pts)
    )

# Get or set input/output data
x_train = np.linspace(-5.0, 5.0, 50)
y_train = np.array([target_function(x) for x in x_train])

# Get predictions from each model
pyholo_pred = holo.Rbf(x_train, y_train, "gaussian", 1.0)

# Points to predict at
x_new = np.linspace(-5.0, 5.0, 500)

# Make predictions
y_pred = pyholo_pred.predict(x_new)

Plotting against other Rbf implementations (scipy, numpy) and the expected values:

3D interpolation of data

import numpy as np
import pyholo as holo

# Training data
x_train = np.array([
    0.000, 512.000, 1182.490, 1911.273, 2788.547, 
    4227.750, 6481.706, 9609.367, 11773.210, 
    13188.649, 14400.000
])

y_train = np.array([
    [6950.000, 0.000, 0.000],
    [5930.999, 4386.866, 974.859],
    [2498.780, 8537.536, 1897.230],
    [-1993.234, 10819.437, 2404.319],
    [-7051.251, 11465.688, 2547.931],
    [-13549.361, 9748.529, 2166.340],
    [-19093.612, 3887.659, 863.924],
    [-18104.032, -5716.279, -1270.284],
    [-11425.229, -10664.783, -2369.952],
    [-4206.775, -11312.308, -2513.846],
    [3167.219, -7987.115, -1774.914],
])

# Create and fit RBF model
rbf = holo.Rbf(x_train, y_train, kernel='thin_plate_spline', epsilon=1.0)

# Predict on test points
x_test = np.linspace(x_train.min(), x_train.max(), 200)
y_pred = rbf.predict(x_test)

Plotting against the training data and expected values:

Comparison with other Rbf implementations

Using the hologram linear solver only, as haven't quite figured out how to configure Openblas or Mkl with Pyo3. Help here is appreciated. Simple 1d problem from before benchmarks quite well.

License

MIT License - See LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pyholo-0.1.6-cp38-abi3-win_amd64.whl (162.2 kB view details)

Uploaded CPython 3.8+Windows x86-64

pyholo-0.1.6-cp38-abi3-manylinux_2_34_x86_64.whl (259.5 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.34+ x86-64

pyholo-0.1.6-cp38-abi3-macosx_11_0_arm64.whl (228.0 kB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

File details

Details for the file pyholo-0.1.6-cp38-abi3-win_amd64.whl.

File metadata

  • Download URL: pyholo-0.1.6-cp38-abi3-win_amd64.whl
  • Upload date:
  • Size: 162.2 kB
  • Tags: CPython 3.8+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.9.0

File hashes

Hashes for pyholo-0.1.6-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 882477020ab6e362f9e9eca9dbd7e13a5fa8d40186cd55ee4cbef5aa5c493ecb
MD5 f5474479c402b8f76d50e4b78169e39e
BLAKE2b-256 168b4ad481a08b188623c0a03631fae510dc55a8ecf4c2ef83622a53db00a372

See more details on using hashes here.

File details

Details for the file pyholo-0.1.6-cp38-abi3-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for pyholo-0.1.6-cp38-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 1fb7ee710414989120d067ce089568f762fa7f336c617b677ce8a4ed49d8d8c3
MD5 849e35ced0e2764a9dfd30f2421731f7
BLAKE2b-256 95608af0c951dba0bf1e175ea7ed2e32e1a6871e505e8f862ec8c4bb33cbfd1b

See more details on using hashes here.

File details

Details for the file pyholo-0.1.6-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyholo-0.1.6-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c8bf7e1a25946b40a9e21c6de69a9dc3ed943400c1095214f8c5859d8fde6c52
MD5 5786c634d45eb2ff1d32f2e891e2b374
BLAKE2b-256 f991f0928fb0f33a91fcad3a43b9e8f7ea5b4328fefadd1a8fd80901fb803484

See more details on using hashes here.

Supported by

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