Skip to content

lemma-osu/sklearn-raster

Repository files navigation

sklearn-raster

Build status Documentation status

⚠️ WARNING: sklearn-raster is in active development! ⚠️

Features

  • 🗺️ Raster predictions from scikit-learn estimators
  • ⚡ Parallelized functions + larger-than-memory data using Dask
  • 🌐 Automatic handling of spatial references, band names, and masks

Quick-Start

  1. Install optional dependencies for loading data and plotting results:

    pip install "sklearn-raster[tutorials] @ git+https://github.com/lemma-osu/sklearn-raster.git"
  2. Wrap a scikit-learn estimator to enable raster-based predictions:

    from sklearn.ensemble import RandomForestRegressor
    from sklearn_raster import wrap
    
    est = wrap(RandomForestRegressor())
  3. 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)
  4. Generate predictions from a numpy or xarray raster 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.

About

Spatial raster prediction with scikit-learn estimators

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Languages