Skip to content

Version 0.9.2

Choose a tag to compare

@M-Mouhcine M-Mouhcine released this 20 Jun 16:40
· 27 commits to main since this release

Version 0.9.2

Highlights

PUNCC 0.9.2 strengthens backend interoperability across NumPy, pandas, PyTorch, JAX, and TensorFlow. This release improves GPU-backed workflows by making backend operations more device-aware, expands backend utilities for array manipulation and model copying, and updates prediction, calibration, and splitting code paths so they no longer assume NumPy-only inputs.

It also adds new tutorials for native TensorFlow/Keras models and custom nonconformity workflows, expands backend regression coverage, and raises the minimum supported scikit-learn version to 1.5.0.

Features

  • For users working across multiple array and tensor frameworks, PUNCC now provides column_stack(...), empty_like(...), and take(...) implementations across NumPy, pandas, PyTorch, JAX, and TensorFlow backends.
  • For users building GPU-backed workflows, backend asarray(...) methods now support an optional like argument to place auxiliary arrays on the same backend device as a reference object when supported.
  • For users integrating native framework models, PUNCC now provides a backend-level copy_model abstraction supporting scikit-learn, JAX, TensorFlow/Keras, and PyTorch models through a unified entrypoint.
  • For users passing heterogeneous inputs at API boundaries, PUNCC now provides normalize_backend_inputs(...) to infer a backend and normalize user-provided inputs once.
  • PUNCC now supports backend-aware data splitting through delegated take(...) operations, enabling row selection across registered backend types.

Bug Fixes

  • Fixed mixed-device prediction set operations by aligning NumPy-derived scores_quantile values with the prediction tensor device for PyTorch, JAX, and TensorFlow backends.
  • Fixed BasePredictor.predict to use the backend abstraction for squeezing instead of calling np.squeeze directly.
  • Fixed TensorFlow asarray(..., like=...) so it aligns dtype with like.dtype in addition to device placement, preventing float32/float64 interval arithmetic failures at prediction time.
  • Fixed framework-agnostic model copy compatibility across predictor wrappers.
  • Fixed backend empty_like(...) behavior and preserved pandas index and column structure for pandas outputs.
  • Fixed the definition of the prediction set for RAPS in the theory overview.
  • Fixed weighted CV+ concatenation by appending an infinite block using the existing array rank instead of a 1-D scalar append.
  • Fixed splitter behavior by replacing the local indexing fallback with backend delegation, preventing splits from producing Python lists of row tensors.

Improvements

  • Refactored predictor wrappers to delegate model cloning to the backend abstraction.
  • Updated the experimental TorchPredictor wrapper to reuse the shared backend copy mechanism.
  • Updated CV conformalization to support GPU acceleration.
  • Updated BasePredictor and DualPredictor to support GPU-accelerated backend workflows.
  • Updated the conformalization module so it no longer assumes NumPy arrays for inputs or outputs.
  • Updated prediction_sets.py to convert scores_quantile with b.asarray(..., like=...), ensuring quantiles are placed on the same device as predictions for backend operations.
  • Updated scaled_interval to convert weights into the prediction backend before interval arithmetic.
  • Updated CvPlusCalibrator to convert nonconformity scores to NumPy before shape handling.
  • Updated nonconformity_scores.py and prediction_sets.py to reuse the shared backend normalization helper where backend inference semantics are preserved.
  • Avoided eager imports from prediction wrappers, including TensorFlow, by detecting loaded frameworks through runtime module inspection.
  • Clarified the backend normalization contract in backend.py docstrings and helper utilities.
  • Expanded automated test coverage for backend-driven model copying, backend normalization, device placement, dtype alignment, row selection, mixed backend calibration inputs, and predictor wrapper copy behavior.
  • Added regression coverage for Torch weight handling, mixed Torch/NumPy classwise LAC, CV+ weight concatenation across folds, Torch/TensorFlow same-device identity, and Torch device movement.
  • Added alternative expected seed results in conformal regression tests for newer scikit-learn versions.
  • Removed Python 3.8 from the tox environment list.

⚠️ Breaking Changes

  • PUNCC now requires scikit-learn 1.5.0 or later.
  • Python 3.8 is no longer included in the tox test environment.
  • Internal backend, prediction, conformalization, and splitting code paths were refactored to rely more consistently on backend abstractions. Downstream code depending on internal APIs may require updates.

Documentation

  • Added a tutorial on using native TensorFlow/Keras models with PUNCC.
  • Added a tutorial on using PUNCC with custom nonconformity scores and calibration workflows.
  • Revised the PyTorch tutorial to use native PyTorch models directly, removing the dependency on Skorch.
  • Updated the TensorFlow conformal prediction tutorial to use native TensorFlow data structures instead of NumPy arrays.
  • Updated backend documentation and helper docstrings to clarify backend normalization semantics.

⬆️ Upgrade Notes

  • Upgrade scikit-learn to version 1.5.0 or later before installing puncc==0.9.2.
  • If you use public high-level APIs, no major migration should be needed beyond validating your environment and backend dependencies.
  • If you use PyTorch, JAX, or TensorFlow tensors directly, review any custom code that mixes NumPy-derived values with framework tensors. PUNCC now aligns auxiliary arrays with the prediction backend more consistently.
  • If you extend internal predictor wrappers, conformalization utilities, nonconformity scores, prediction sets, or splitting logic, review the backend abstraction changes carefully.
  • If you still rely on Skorch in examples or local tutorials, update PyTorch workflows to use native PyTorch models directly.