Spatial raster prediction with scikit-learn estimators.
Project description
sklearn-raster
⚠️ WARNING: sklearn-raster is in active development! ⚠️
sklearn-raster extends scikit-learn and other compatible estimators to work directly with raster data. This allows you to train models with tabular data and predict raster outputs directly while preserving metadata like spatial references, band names, and NoData masks.
Features
- ⚡ Parallelized functions + larger-than-memory data using Dask
- 🌐 Automatic handling of spatial references, band names, and masks
- 🔢 Support for n-dimensional feature arrays, e.g. time series rasters
Quick-Start
-
Install optional dependencies for loading data and plotting results:
pip install "sklearn-raster[tutorials]"
-
Wrap a
scikit-learnestimator with aFeatureArrayEstimatorto enable raster-based predictions:from sklearn.ensemble import RandomForestRegressor from sklearn_raster import FeatureArrayEstimator est = FeatureArrayEstimator(RandomForestRegressor())
-
Load a custom dataset of features and targets and fit the wrapped estimator:
from sklearn_raster.datasets import load_swo_ecoplot X_image, X, y = load_swo_ecoplot(as_dataset=True) est.fit(X, y)
-
Generate predictions from a
numpyorxarrayraster with predictors as bands:pred = est.predict(X_image) pred["PSME_COV"].plot()
Acknowledgements
Thanks to the USDA Forest Service Region 6 Ecology Team for the inclusion of the SWO Ecoplot dataset (Atzet et al., 1996). Development of this package was funded by:
- an appointment to the United States Forest Service (USFS) Research Participation Program administered by the Oak Ridge Institute for Science and Education (ORISE) through an interagency agreement between the U.S. Department of Energy (DOE) and the U.S. Department of Agriculture (USDA).
- a joint venture agreement between USFS Pacific Northwest Research Station and Oregon State University (agreement 19-JV-11261959-064).
- a cost-reimbursable agreement between USFS Region 6 and Oregon State University (agreeement 21-CR-11062756-046).
References
- Atzet, T, DE White, LA McCrimmon, PA Martinez, PR Fong, and VD Randall. 1996. Field guide to the forested plant associations of southwestern Oregon. USDA Forest Service. Pacific Northwest Region, Technical Paper R6-NR-ECOL-TP-17-96.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sklearn_raster-0.1.0.dev1.tar.gz.
File metadata
- Download URL: sklearn_raster-0.1.0.dev1.tar.gz
- Upload date:
- Size: 22.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9dba7bcd3d9362d08fd39b0223f70fa9df2bcc54c6c17fb618b932ae9450dd61
|
|
| MD5 |
49f9caa54aa944e3a5995c9fc58b1a26
|
|
| BLAKE2b-256 |
b6be458ded4688eca2d10de41c1c25d48967972ab5c61f6af1a9e5caa07f616d
|
Provenance
The following attestation bundles were made for sklearn_raster-0.1.0.dev1.tar.gz:
Publisher:
publish.yaml on lemma-osu/sklearn-raster
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sklearn_raster-0.1.0.dev1.tar.gz -
Subject digest:
9dba7bcd3d9362d08fd39b0223f70fa9df2bcc54c6c17fb618b932ae9450dd61 - Sigstore transparency entry: 683041338
- Sigstore integration time:
-
Permalink:
lemma-osu/sklearn-raster@37c729454ebb5d1eb812395b9453a0ee3fc8de06 -
Branch / Tag:
refs/tags/v0.1.0.dev1 - Owner: https://github.com/lemma-osu
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@37c729454ebb5d1eb812395b9453a0ee3fc8de06 -
Trigger Event:
push
-
Statement type:
File details
Details for the file sklearn_raster-0.1.0.dev1-py3-none-any.whl.
File metadata
- Download URL: sklearn_raster-0.1.0.dev1-py3-none-any.whl
- Upload date:
- Size: 27.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
32b056c30f7344a4fecb183a7e9380d92382a966d1093101af702a6991deb4b4
|
|
| MD5 |
625b840c3ef99b7a0f36e89226788211
|
|
| BLAKE2b-256 |
2ec3fbaa4ab12dc9d004685fded3fc056e0e17c3aedd7f4ba1992b7ebb75eed1
|
Provenance
The following attestation bundles were made for sklearn_raster-0.1.0.dev1-py3-none-any.whl:
Publisher:
publish.yaml on lemma-osu/sklearn-raster
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sklearn_raster-0.1.0.dev1-py3-none-any.whl -
Subject digest:
32b056c30f7344a4fecb183a7e9380d92382a966d1093101af702a6991deb4b4 - Sigstore transparency entry: 683041371
- Sigstore integration time:
-
Permalink:
lemma-osu/sklearn-raster@37c729454ebb5d1eb812395b9453a0ee3fc8de06 -
Branch / Tag:
refs/tags/v0.1.0.dev1 - Owner: https://github.com/lemma-osu
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@37c729454ebb5d1eb812395b9453a0ee3fc8de06 -
Trigger Event:
push
-
Statement type: