Skip to content

Conversation

@thomass-dev
Copy link
Collaborator

@thomass-dev thomass-dev commented Jan 9, 2026

Caution

Just a notebook for reflection for now.

Points to cover:

  • show the docstr of metric function (example of r2)
  • show the helper
    • standard metrics
    • custom metrics
  • deal with CrossValidation (only metrics)

Closes https://github.com/probabl-ai/skore-hub/issues/940.

@thomass-dev thomass-dev changed the title Skore custom metric registry feat(skore): Create a "custom" metrics registry under each report Jan 9, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Jan 9, 2026

Coverage

Coverage Report for skore/
FileStmtsMissCoverMissing
skore/src/skore
   __init__.py240100% 
   _config.py310100% 
   exceptions.py440%4, 15, 19, 23
skore/src/skore/_sklearn
   __init__.py60100% 
   _base.py1991492%46, 59, 128, 131, 184, 187–188, 190–193, 226, 229–230
   find_ml_task.py610100% 
   types.py28196%30
skore/src/skore/_sklearn/_comparison
   __init__.py70100% 
   feature_importance_accessor.py35294%93, 117
   metrics_accessor.py179398%169, 249, 1212
   report.py1080100% 
   utils.py570100% 
skore/src/skore/_sklearn/_cross_validation
   __init__.py90100% 
   data_accessor.py45393%134, 137, 140
   feature_importance_accessor.py240100% 
   metrics_accessor.py183199%242
   report.py136199%490
skore/src/skore/_sklearn/_estimator
   __init__.py90100% 
   data_accessor.py66198%82
   feature_importance_accessor.py168298%258–259
   metrics_accessor.py388598%331, 400, 404, 419, 454
   report.py166298%449–450
skore/src/skore/_sklearn/_plot
   __init__.py30100% 
   base.py106694%61–62, 247–249, 253
   utils.py770100% 
skore/src/skore/_sklearn/_plot/data
   __init__.py20100% 
   table_report.py185199%706
skore/src/skore/_sklearn/_plot/metrics
   __init__.py60100% 
   confusion_matrix.py940100% 
   feature_importance_coefficients_display.py712170%116–119, 121, 140, 146–152, 155, 161–165, 170–171
   metrics_summary_display.py80100% 
   precision_recall_curve.py175298%441–442
   prediction_error.py233597%179, 186, 423, 506, 706
   roc_curve.py314997%263, 455, 578, 583, 684, 689, 693, 762, 902
skore/src/skore/_sklearn/train_test_split
   __init__.py00100% 
   train_test_split.py580100% 
skore/src/skore/_sklearn/train_test_split/warning
   __init__.py80100% 
   high_class_imbalance_too_few_examples_warning.py19194%83
   high_class_imbalance_warning.py200100% 
   random_state_unset_warning.py100100% 
   shuffle_true_warning.py90100% 
   stratify_is_set_warning.py100100% 
   time_based_column_warning.py210100% 
   train_test_split_warning.py30100% 
skore/src/skore/_utils
   __init__.py6266%8, 13
   _accessor.py90396%34, 146, 190
   _cache.py370100% 
   _environment.py27196%40
   _fixes.py80100% 
   _index.py50100% 
   _logger.py22481%15–17, 19
   _measure_time.py100100% 
   _parallel.py38392%23, 33, 124
   _patch.py211242%30, 35–39, 42–43, 46–47, 58, 60
   _progress_bar.py460100% 
   _repr_html.py80100% 
   _show_versions.py380100% 
   _testing.py560100% 
skore/src/skore/project
   __init__.py20100% 
   project.py570100% 
   summary.py75198%120
   widget.py1870100% 
TOTAL409811097% 

Tests Skipped Failures Errors Time
1175 5 💤 0 ❌ 0 🔥 4m 23s ⏱️

@github-actions
Copy link
Contributor

github-actions bot commented Jan 9, 2026

Documentation preview @ 483d21e

@thomass-dev
Copy link
Collaborator Author

thomass-dev commented Jan 9, 2026

from sklearn.datasets import make_regression
from sklearn.linear_model import LinearRegression
from sklearn.metrics import get_scorer
from sklearn.model_selection import train_test_split

from skore._sklearn._metric.registry import NewEstimatorReport

X, y = make_regression(random_state=42)
X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=42)

report = NewEstimatorReport(
    LinearRegression(),
    X_train=X_train,
    y_train=y_train,
    X_test=X_test,
    y_test=y_test,
)

def my_business_metric(*args, **kwargs):
    return 1

report.metrics.append(get_scorer("explained_variance"))
report.metrics.append("neg_mean_squared_error")
report.metrics.append(my_business_metric)

print(report.metrics)
print(report.metrics.r2())
print(report.metrics.explained_variance_score())
print(report.metrics.mean_squared_error())
print(report.metrics.my_business_metric())

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant