Skip to main content

A unified framework for tabular probabilistic regression, time-to-event prediction, and probability distributions in python

Project description

:rocket: Version 2.11.0 out now! Read the release notes here..

skpro is a library for supervised probabilistic prediction in python. It provides scikit-learn-like, scikit-base compatible interfaces to:

  • tabular supervised regressors for probabilistic prediction - interval, quantile and distribution predictions
  • tabular probabilistic time-to-event and survival prediction - instance-individual survival distributions
  • metrics to evaluate probabilistic predictions, e.g., pinball loss, empirical coverage, CRPS, survival losses
  • reductions to turn scikit-learn regressors into probabilistic skpro regressors, such as bootstrap or conformal
  • building pipelines and composite models, including tuning via probabilistic performance metrics
  • symbolic probability distributions with value domain of pandas.DataFrame-s and pandas-like interface
Overview
Open Source BSD 3-clause GC.OS Sponsored
Tutorials Binder !youtube
Community !discord !slack
CI/CD github-actions !codecov readthedocs platform
Code !pypi !conda !python-versions !black
Downloads PyPI - Downloads PyPI - Downloads Downloads
Citation DOI

:books: Documentation

Documentation
:star: Tutorials New to skpro? Here's everything you need to know!
:clipboard: Binder Notebooks Example notebooks to play with in your browser.
:woman_technologist: User Guides How to use skpro and its features.
:scissors: Extension Templates How to build your own estimator using skpro's API.
:control_knobs: API Reference The detailed reference for skpro's API.
:hammer_and_wrench: Changelog Changes and version history.
:deciduous_tree: Roadmap skpro's software and community development plan.
:pencil: Related Software A list of related software.

:speech_balloon: Where to ask questions

Questions and feedback are extremely welcome! We strongly believe in the value of sharing help publicly, as it allows a wider audience to benefit from it.

skpro is maintained by the sktime community, we use the same social channels.

Type Platforms
:bug: Bug Reports GitHub Issue Tracker
:sparkles: Feature Requests & Ideas GitHub Issue Tracker
:woman_technologist: Usage Questions GitHub Discussions · Stack Overflow
:speech_balloon: General Discussion GitHub Discussions
:factory: Contribution & Development dev-chat channel · Discord
:globe_with_meridians: Community collaboration session Discord - Fridays 13 UTC, dev/meet-ups channel

:dizzy: Features

Our objective is to enhance the interoperability and usability of the AI model ecosystem:

  • skpro is compatible with scikit-learn and sktime, e.g., an sktime proba forecaster can be built with an skpro proba regressor which in an sklearn regressor with proba mode added by skpro

  • skpro provides a mini-package management framework for first-party implementations, and for interfacing popular second- and third-party components, such as cyclic-boosting, MAPIE, or ngboost packages.

skpro curates libraries of components of the following types:

Module Status Links
Probabilistic tabular regression maturing Tutorial · API Reference · Extension Template
Time-to-event (survival) prediction maturing Tutorial · API Reference · Extension Template
Performance metrics maturing API Reference
Probability distributions maturing Tutorial · API Reference · Extension Template

:hourglass_flowing_sand: Installing skpro

To install skpro, use pip:

pip install skpro

or, with maximum dependencies,

pip install skpro[all_extras]

Releases are available as source packages and binary wheels. You can see all available wheels here.

:zap: Quickstart

Making probabilistic predictions

from sklearn.datasets import load_diabetes
from sklearn.ensemble import RandomForestRegressor
from sklearn.linear_model import LinearRegression
from sklearn.model_selection import train_test_split

from skpro.regression.residual import ResidualDouble

# step 1: data specification
X, y = load_diabetes(return_X_y=True, as_frame=True)
X_train, X_new, y_train, _ = train_test_split(X, y)

# step 2: specifying the regressor - any compatible regressor is valid!
# example - "squaring residuals" regressor
# random forest for mean prediction
# linear regression for variance prediction
reg_mean = RandomForestRegressor()
reg_resid = LinearRegression()
reg_proba = ResidualDouble(reg_mean, reg_resid)

# step 3: fitting the model to training data
reg_proba.fit(X_train, y_train)

# step 4: predicting labels on new data

# probabilistic prediction modes - pick any or multiple

# full distribution prediction
y_pred_proba = reg_proba.predict_proba(X_new)

# interval prediction
y_pred_interval = reg_proba.predict_interval(X_new, coverage=0.9)

# quantile prediction
y_pred_quantiles = reg_proba.predict_quantiles(X_new, alpha=[0.05, 0.5, 0.95])

# variance prediction
y_pred_var = reg_proba.predict_var(X_new)

# mean prediction is same as "classical" sklearn predict, also available
y_pred_mean = reg_proba.predict(X_new)

Evaluating predictions

# step 5: specifying evaluation metric
from skpro.metrics import CRPS

metric = CRPS()  # continuous rank probability score - any skpro metric works!

# step 6: evaluat metric, compare predictions to actuals
metric(y_test, y_pred_proba)
>>> 32.19

:wave: How to get involved

There are many ways to get involved with development of skpro, which is developed by the sktime community. We follow the all-contributors specification: all kinds of contributions are welcome - not just code.

Documentation
:gift_heart: Contribute How to contribute to skpro.
:school_satchel: Mentoring New to open source? Apply to our mentoring program!
:date: Meetings Join our discussions, tutorials, workshops, and sprints!
:woman_mechanic: Developer Guides How to further develop the skpro code base.
:medal_sports: Contributors A list of all contributors.
:raising_hand: Roles An overview of our core community roles.
:money_with_wings: Donate Fund sktime and skpro maintenance and development.
:classical_building: Governance How and by whom decisions are made in the sktime community.

:wave: Citation

To cite skpro in a scientific publication, see citations.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

skpro-2.11.0.tar.gz (305.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

skpro-2.11.0-py3-none-any.whl (450.1 kB view details)

Uploaded Python 3

File details

Details for the file skpro-2.11.0.tar.gz.

File metadata

  • Download URL: skpro-2.11.0.tar.gz
  • Upload date:
  • Size: 305.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for skpro-2.11.0.tar.gz
Algorithm Hash digest
SHA256 8b9c70bfce037e8ec5e7a3650f86fe183db67498b22d61f01759091128e11b79
MD5 6898ce544635ed3f9b45ae3b2c42305b
BLAKE2b-256 6511cf5527cc37f3bfd0ca572f1df9a31e65f1e579beff9334926780af72afb7

See more details on using hashes here.

Provenance

The following attestation bundles were made for skpro-2.11.0.tar.gz:

Publisher: wheels.yml on sktime/skpro

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file skpro-2.11.0-py3-none-any.whl.

File metadata

  • Download URL: skpro-2.11.0-py3-none-any.whl
  • Upload date:
  • Size: 450.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for skpro-2.11.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cd619a8e7b5022c21bb9f0ff5c5e1a84f5440ff6418b424359d0515b5328adae
MD5 8e4aba2d64f60c50c388573c21842528
BLAKE2b-256 b05af70f266c28757268535ccc62740059e563de93138fce11917a375fa49419

See more details on using hashes here.

Provenance

The following attestation bundles were made for skpro-2.11.0-py3-none-any.whl:

Publisher: wheels.yml on sktime/skpro

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page