Lazyfit
This is the lazy fit python package. This package provides classes and methods that may be used to build radial basis function interpolants and optimize their behaviors.
Rbf interpolation is a mesh-free interpolation technique in which a set of radial basis function are used as the basis for a Haar space. The interpolant takes the form:
$$ L(p) = \sum_{i = 0}^n \lambda_i \varphi(||p - p_i ||) $$
It is governed by the interpolation condition:
$$ F_j = \sum_{i = 0}^n \lambda_i \varphi(||p_i - p_j||) $$
Where $p_i$ and $p_j$ are points in the input data and $F_j$ is the known function value associated with $p_j$.
Classes
LazyFitter
The lazyfitter is the primary class of the package. It aims to provide a simple interface that builds and optimizes the interpolation behind the scene.
Constructor
LazyFitter(coordinates, function_values, epsilon = 1) Parameters:
- coordinates: array_like
An array_like that contains the coordinates to build the interpolant. For m data points in $\mathbb{R^n}$ the shape is (m, n), this includes data on $\mathbb{R}$ which has shape (m, 1) not just (m).
- function_values: array_like
An array_like that contains the function values associated with the coordinates index aligned. For m data points, the shape is (m).
- epsilon: float
The shape parameter of the interpolant, default is 1.
Member Variables:
-
coordinates: array_like
An array_like that contains the coordinates to build the interpolant. For m data points in $\mathbb{R^n}$ the shape is (m, n), this includes data on $\mathbb{R}$ which has shape (m, 1) not just (m).
-
function_values: array_like
An array_like that contains the function values associated with the coordinates index aligned. For m data points, the shape is (m).
-
epsilon: float
Same as the epsilon in object creation, may change with optimization.
-
min_error: list
Two entries, the first is the name of the minimum error basis function and the second is the RMS leave-one-out cross-validation error of that interpolant.
Member Functions:
- OptimizeShape()
Optimizes the current basis function interpolant by shape parameter. Uses a bounded Brent's algorithm for the optimization the error estimator as a function of shape parameter.
- Interpolate(x): array_like
returns the evaluation of the interpolant at the point x.
Rbf
Constructor
Rbf(coordinates, function_values, kernel, epsilon = 1, norm_weights = None)
- coordinates: array_like
An array_like that contains the coordinates to build the interpolant. For m data points in $\mathbb{R^n}$ the shape is (m, n), this includes data on $\mathbb{R}$ which has shape (m, 1) not just (m).
- function_values: array_like
An array_like that contains the function values associated with the coordinates index aligned. For m data points, the shape is (m).
- kernel
- One of:
- "linear" : $\varphi(r) = r$
- "thin_plate_spline" : $\varphi(r) = r^2 log(r)$
- "cubic" : $\varphi(r) = r^3$
- "quintic" : $\varphi(r) = r^5$
- "gaussian" : $\varphi(r) = e^{-(\epsilon r)^2}$
- "multiquadric" : $\varphi(r) = -\sqrt{1 + (\epsilon r)^2}$
- "inverse_quadric" : $\varphi(r) = \frac{1}{1 + (\epsilon r)^2}$
- One of:
- epsilon: float
The shape parameter of the interpolant, default is 1.
- norm_weights: array_like
An array of the weights to be given to the various dimensions to the standard Euclidean norm. This produces an augmented Euclidean norm that is "equivalent" in the mathematical sense regarding normed spaces. Here norm_weights represents $a_i$ in the norm equation $||p_i - p_j|| = \sqrt{\sum_{k = 0}^n a_i (p_{i, k} - p_{j, k})^2}$ for $p_i, p_j$ on $\mathbb{R}^n$. If that were a standard Euclidean norm then $a_i$ would be all 1's.
Member Variables:
- coordinates: array_like
An array_like that contains the coordinates to build the interpolant. For m data points in $\mathbb{R^n}$ the shape is (m, n), this includes data on $\mathbb{R}$ which has shape (m, 1) not just (m).
- function_values: array_like
An array_like that contains the function values associated with the coordinates index aligned. For m data points, the shape is (m).
- n : int
The number of cooridnates/function_values given on construction.
- kernel
- One of:
- "linear" : $\varphi(r) = r$
- "thin_plate_spline" : $\varphi(r) = r^2 log(r)$
- "cubic" : $\varphi(r) = r^3$
- "quintic" : $\varphi(r) = r^5$
- "gaussian" : $\varphi(r) = e^{-(\epsilon r)^2}$
- "multiquadric" : $\varphi(r) = -\sqrt{1 + (\epsilon r)^2}$
- "inverse_quadric" : $\varphi(r) = \frac{1}{1 + (\epsilon r)^2}$
- One of:
- epsilon: float
The shape parameter of the interpolant, default is 1. Changing this after construction will not rebuild the interpolant.
- weights : array
The coefficients of the interpolant's basis functions.
- is_singular: boolean
describes whether or not the basis function matrix $\Phi_{ij} = \varphi(||p_i - p_j||)$ is singular.
- average_error:
The RMS leave-one-out error of the interpolant, calculated on construction of the object. Calculation runs in $O(n^3)$ time.
Member Functions:
- Interpolate(point):
Evaluates the interpolant at point.
Dependancies
This Library has both scipy and numpy dependancies:
- numpy: 1.23.5
- scipy: 1.10.1
CHANGELOG
Version 0.1.2 11/19/2023
- Updated: Changed the license info.
- Fixed:
- ...
Metadata
Release files for lazyfit 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| lazyfit-0.1.2.tar.gz | 6.2 kB | Without provenance | Details for lazyfit-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| lazyfit-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for lazyfit-0.1.2-py3-none-any.whl |
Total release size: 12.1 kB
Release files / lazyfit-0.1.2.tar.gz
| Download URL | lazyfit-0.1.2.tar.gz |
|---|---|
| Size | 6.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ef7e56c165285c556b868d22e9effc2208a528bd7006cc76ede2f79be6dcdd43
|
|
BLAKE2b-256 checksum How to use checksums |
c3b48e5c6090e7942575c387f48884f29394a428f11d3eecaa6590c77523b500
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.2
|
Release files / lazyfit-0.1.2-py3-none-any.whl
| Download URL | lazyfit-0.1.2-py3-none-any.whl |
|---|---|
| Size | 5.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7921a52f026835d9da7c956f835c908a212f1660f6ff08159403cd0f9b3fbef1
|
|
BLAKE2b-256 checksum How to use checksums |
acb69a7190289988daf10a76a8f0c5bd2dc21941e8b9f6a4ffe39eec0a8dad9b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.2
|
Security for lazyfit 0.1.2
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.