
[](https://github.com/psf/black)
[](https://coveralls.io/github/sustainability-lab/polire?branch=master)
## Polire
```python
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](https://sustainability-lab.github.io/polire/) to check out practical examples on real datasets.
### Minimal example of interpolation
```python
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
```python
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)
```python
from GPy.kern import Matern32 # or any other GPy kernel
# GP model
model = GP(Matern32(input_dim=2))
```
### Regressors from sklearn
```py
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
```python
# 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}
}
```
Raw data
{
"_id": null,
"home_page": "https://github.com/sustainability-lab/polire",
"name": "polire",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "",
"keywords": "",
"author": "Zeel B Patel, Deepak Narayanan, Apoorv Agnihotri, Nipun Batra",
"author_email": "patel_zeel@iitgn.ac.in",
"download_url": "https://files.pythonhosted.org/packages/c9/00/44f37a538a586b1394a2dcb5b114f3f7f3de94268c15941705715cf01651/polire-0.1.5.tar.gz",
"platform": null,
"description": "\n[](https://github.com/psf/black)\n[](https://coveralls.io/github/sustainability-lab/polire?branch=master)\n\n## Polire\n\n```python\npip install polire\n```\n\n\nThe word \"interpolation\" has a Latin origin and is composed of two words - Inter, meaning between, and Polire, meaning to polish.\n\n\nThis repository is a collection of several spatial interpolation algorithms. \n\n\n## Examples\nPlease refer to [the documentation](https://sustainability-lab.github.io/polire/) to check out practical examples on real datasets.\n\n### Minimal example of interpolation\n```python\nimport numpy as np\nfrom polire import Kriging\n\n# Data\nX = np.random.rand(10, 2) # Spatial 2D points\ny = np.random.rand(10) # Observations\nX_new = np.random.rand(100, 2) # New spatial points\n\n# Fit\nmodel = Kriging()\nmodel.fit(X, y)\n\n# Predict\ny_new = model.predict(X_new)\n```\n\n### Supported Interpolation Methods\n```python\nfrom polire import (\n Kriging, # Best spatial unbiased predictor\n GP, # Gaussian process interpolator from GPy\n IDW, # Inverse distance weighting\n SpatialAverage,\n Spline,\n Trend,\n Random, # Predict uniformly within the observation range, a reasonable baseline\n NaturalNeighbor,\n CustomInterpolator # Supports any regressor from Scikit-learn\n)\n```\n\n### Use GP kernels from GPy (temporarily unavailable)\n```python\nfrom GPy.kern import Matern32 # or any other GPy kernel\n\n# GP model\nmodel = GP(Matern32(input_dim=2))\n```\n\n### Regressors from sklearn\n```py\nfrom sklearn.linear_model import LinearRegression # or any Scikit-learn regressor\nfrom polire import GP, CustomInterpolator\n\n# Sklearn model\nmodel = CustomInterpolator(LinearRegression())\n```\n\n### Extract spatial features from spatio-temporal dataset\n```python\n# X and X_new are datasets as numpy arrays with first three dimensions as longitude, latitute and time.\n# y is corresponding observations with X\n\nfrom polire.preprocessing import SpatialFeatures\nspatial = SpatialFeatures(n_closest=10)\nFeatures = spatial.fit_transform(X, y)\nFeatures_new = spatial.transform(X_new)\n```\n\n## Citation\n\nIf you use this library, please cite the following paper:\n\n```\n@inproceedings{10.1145/3384419.3430407,\nauthor = {Narayanan, S Deepak and Patel, Zeel B and Agnihotri, Apoorv and Batra, Nipun},\ntitle = {A Toolkit for Spatial Interpolation and Sensor Placement},\nyear = {2020},\nisbn = {9781450375900},\npublisher = {Association for Computing Machinery},\naddress = {New York, NY, USA},\nurl = {https://doi.org/10.1145/3384419.3430407},\ndoi = {10.1145/3384419.3430407},\nbooktitle = {Proceedings of the 18th Conference on Embedded Networked Sensor Systems},\npages = {653\u2013654},\nnumpages = {2},\nlocation = {Virtual Event, Japan},\nseries = {SenSys '20}\n}\n```\n",
"bugtrack_url": null,
"license": "BSD 3-Clause License",
"summary": "Spatial Interpolation in Python",
"version": "0.1.5",
"project_urls": {
"Homepage": "https://github.com/sustainability-lab/polire"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c90044f37a538a586b1394a2dcb5b114f3f7f3de94268c15941705715cf01651",
"md5": "8ecada2c0f3bc7a3268f2d78c00a96d0",
"sha256": "006793faff13ffc3d327d6dac357f3aa165ef5ad2ad761779619789830a30783"
},
"downloads": -1,
"filename": "polire-0.1.5.tar.gz",
"has_sig": false,
"md5_digest": "8ecada2c0f3bc7a3268f2d78c00a96d0",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 1456693,
"upload_time": "2023-10-28T00:24:10",
"upload_time_iso_8601": "2023-10-28T00:24:10.383461Z",
"url": "https://files.pythonhosted.org/packages/c9/00/44f37a538a586b1394a2dcb5b114f3f7f3de94268c15941705715cf01651/polire-0.1.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-10-28 00:24:10",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "sustainability-lab",
"github_project": "polire",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "matplotlib",
"specs": []
},
{
"name": "numpy",
"specs": []
},
{
"name": "pandas",
"specs": []
},
{
"name": "pykrige",
"specs": []
},
{
"name": "scipy",
"specs": []
},
{
"name": "seaborn",
"specs": []
},
{
"name": "Shapely",
"specs": []
},
{
"name": "xgboost",
"specs": []
}
],
"lcname": "polire"
}