TLDR : Scikit-learn 1.7 introduces enhancements for a smoother machine learning experience, including improved estimator visualization, new validation methods, native ROC visualization, and expanded compatibility with Array API.
Scikit-learn, the essential open-source ML library in Python, continues to evolve with version 1.7 released on June 5th. This update enhances usability, compatibility with other tools, and the efficiency of machine learning workflows.
Improvements and New Features
Improved HTML Visualization of Estimators
The HTML representation in Jupyter now displays the full list of parameters, highlighting those that differ from default values. A button facilitates copying fully qualified names, speeding up the configuration of nested pipelines and hyperparameter searches.
Custom Validation for Histogram-Based Gradient Boosting
HistGradientBoosting models can now receive an explicit validation set (
X_val, y_val, sample_weight_val) via the .fit() method to better tune early stopping. This capability refines overfitting management but relies on the metadata routing system (enable_metadata_routing=True ), which is still underused.Native ROC Visualization from Cross-Validation Results
The new method
from_cv_results() for RocCurveDisplay allows the automatic generation of multiple ROC curves from cross-validation results (cross_validate). This feature simplifies model comparison analysis and directly integrates visual diagnostics into machine learning workflows without needing third-party tools.Extended Compatibility with Array API
Several metrics (e.g.,
fbeta_score, explained_variance_score) now accept Array API-compatible data structures (notably from PyTorch or CuPy). The array-api-compat module is natively integrated.Updates to the Multilayer Perceptron
The Multilayer Perceptron now integrates Poisson loss, in addition to the default squared_error loss. It also supports sample weights, enhancing its flexibility for various applications.
Migration to Sparse Arrays
All estimators that accept input in classic sparse matrices (
scipy.sparse) now accept the new sparse arrays (sparray), preparing for the ongoing transition in SciPy.Installation
The new version can be installed via pip: pip install --upgrade scikit-learn
or with conda: conda install -c conda-forge scikit-learn