Skip to content

Conversation

@thomass-dev
Copy link
Collaborator

@thomass-dev thomass-dev commented Sep 5, 2025

The attribute _cache can't be missing after depickling the report:

File skore/_sklearn/_estimator/metrics_accessor.py:1461, in _MetricsAccessor._rmse(self, data_source, data_source_hash, X, y, multioutput)
   1439 @available_if(
   1440     _check_supported_ml_task(
   1441         supported_ml_tasks=["regression", "multioutput-regression"]
   (...)   1453     ) = "raw_values",
   1454 ) -> float | list:
   1455     """Private interface of `rmse` to be able to pass `data_source_hash`.
   1456 
   1457     `data_source_hash` is either an `int` when we already computed the hash
   1458     and are able to pass it around or `None` and thus trigger its computation
   1459     in the underlying process.
   1460     """
-> 1461     result = self._compute_metric_scores(
   1462         metrics.root_mean_squared_error,
   1463         X=X,
   1464         y_true=y,
   1465         data_source=data_source,
   1466         data_source_hash=data_source_hash,
   1467         response_method="predict",
   1468         multioutput=multioutput,
   1469     )
   1470     if (
   1471         self._parent._ml_task == "multioutput-regression"
   1472         and multioutput == "raw_values"
   1473     ):
   1474         return cast(list, result)

File skore/_sklearn/_estimator/metrics_accessor.py:475, in _MetricsAccessor._compute_metric_scores(self, metric_fn, X, y_true, response_method, data_source, data_source_hash, pos_label, **metric_kwargs)
    471         cache_key_parts.append(value)
    473 cache_key = tuple(cache_key_parts)
--> 475 if cache_key in self._parent._cache:
    476     score = self._parent._cache[cache_key]
    477 else:

AttributeError: 'EstimatorReport' object has no attribute '_cache'

@thomass-dev thomass-dev requested a review from rouk1 September 5, 2025 10:39
@thomass-dev thomass-dev changed the title fix(skore-local-project): Clear reports cache instead of popping the attribute fix(skore-local-project): Clear the report cache instead of deleting it Sep 5, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Sep 5, 2025

Coverage

Coverage Report for skore-local-project/
FileStmtsMissCoverMissing
skore-local-project/src/skore_local_project
   __init__.py50100% 
   metadata.py88495%22, 32, 149–150
   project.py102199%250
   storage.py40295%45, 187
TOTAL235797% 

Tests Skipped Failures Errors Time
23 0 💤 0 ❌ 0 🔥 6.518s ⏱️

@thomass-dev thomass-dev force-pushed the skore-local-project-fix-report-cache branch from 72c262b to bacef1c Compare September 5, 2025 10:42
@thomass-dev thomass-dev changed the title fix(skore-local-project): Clear the report cache instead of deleting it fix(skore-local-project): Clear the report cache instead of deleting it before serialization Sep 5, 2025
@rouk1 rouk1 enabled auto-merge September 5, 2025 11:57
@rouk1 rouk1 added this pull request to the merge queue Sep 5, 2025
Merged via the queue into main with commit 57e3653 Sep 5, 2025
37 checks passed
@rouk1 rouk1 deleted the skore-local-project-fix-report-cache branch September 5, 2025 12:01
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.

3 participants