Smooth State

Fast smoothing of state probabilities, built for Polars.

Requires Python 3.10 or newer

AI / Agents

Skills
llms.txt
llms-full.txt

Meta

Requires: Python >=3.10
Provides-Extra: dev
Package Info

smoothstate

Fast, dependency-light smoothing of state probabilities for Python, built for Polars.

smoothstate provides focused smoothing primitives for model-evaluation workflows. It was created to support the smooth calibration machinery in rtichoke without requiring a general-purpose survival-modeling stack at runtime.

The package currently includes:

  • smooth_binary_state() for smoothing binary state probabilities over a continuous predictor.
  • smooth_state_cox() for time-dependent smoothing with a complementary log-log transformed probability, a 3-knot restricted cubic spline, and a secondary Cox model.

The Cox implementation is continuously validated against Python lifelines and R survival::coxph(). In the current GitHub Actions benchmark it reproduces the reference curves to numerical precision while running roughly 26–39× faster than lifelines for this deliberately narrow workload.

Installation

uv add smoothstate

Until the first PyPI release is published, install directly from GitHub:

uv add git+https://github.com/uriahf/smoothstate

Documentation

See the Great Docs site for the user guide, implementation details, benchmarks, and API reference.