Skip to main content

Tests Code style: black Coverage

Polire

pip install polire

The word "interpolation" has a Latin origin and is composed of two words - Inter, meaning between, and Polire, meaning to polish.

This repository is a collection of several spatial interpolation algorithms.

Examples

Please refer to the documentation to check out practical examples on real datasets.

Minimal example of interpolation

import numpy as np
from polire import Kriging

# Data
X = np.random.rand(10, 2) # Spatial 2D points
y = np.random.rand(10) # Observations
X_new = np.random.rand(100, 2) # New spatial points

# Fit
model = Kriging()
model.fit(X, y)

# Predict
y_new = model.predict(X_new)

Supported Interpolation Methods

from polire import (
    Kriging, # Best spatial unbiased predictor
    GP, # Gaussian process interpolator from GPy
    IDW, # Inverse distance weighting
    SpatialAverage,
    Spline,
    Trend,
    Random, # Predict uniformly within the observation range, a reasonable baseline
    NaturalNeighbor,
    CustomInterpolator # Supports any regressor from Scikit-learn
)

Use GP kernels from GPy (temporarily unavailable)

from GPy.kern import Matern32 # or any other GPy kernel

# GP model
model = GP(Matern32(input_dim=2))

Regressors from sklearn

from sklearn.linear_model import LinearRegression # or any Scikit-learn regressor
from polire import GP, CustomInterpolator

# Sklearn model
model = CustomInterpolator(LinearRegression())

Extract spatial features from spatio-temporal dataset

# X and X_new are datasets as numpy arrays with first three dimensions as longitude, latitute and time.
# y is corresponding observations with X

from polire.preprocessing import SpatialFeatures
spatial = SpatialFeatures(n_closest=10)
Features = spatial.fit_transform(X, y)
Features_new = spatial.transform(X_new)

Citation

If you use this library, please cite the following paper:

@inproceedings{10.1145/3384419.3430407,
author = {Narayanan, S Deepak and Patel, Zeel B and Agnihotri, Apoorv and Batra, Nipun},
title = {A Toolkit for Spatial Interpolation and Sensor Placement},
year = {2020},
isbn = {9781450375900},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
url = {https://doi.org/10.1145/3384419.3430407},
doi = {10.1145/3384419.3430407},
booktitle = {Proceedings of the 18th Conference on Embedded Networked Sensor Systems},
pages = {653–654},
numpages = {2},
location = {Virtual Event, Japan},
series = {SenSys '20}
}

Release files for polire 0.1.5

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

Source distribution (sdist)

Source distribution for polire 0.1.5
File Size Uploaded
polire-0.1.5.tar.gz 1.5 MB Details

Release files / polire-0.1.5.tar.gz

Download URL polire-0.1.5.tar.gz
Size 1.5 MB
Tags Source
SHA-256 checksum
How to use checksums
006793faff13ffc3d327d6dac357f3aa165ef5ad2ad761779619789830a30783
BLAKE2b-256 checksum
How to use checksums
c90044f37a538a586b1394a2dcb5b114f3f7f3de94268c15941705715cf01651
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.12.0

Release history Release notifications | RSS feed

This release

0.1.5 This release

1 release file

0.1.4

1 release file

0.1.3

3 release files

0.1.2

2 release files

0.1.0

1 release file

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