Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Modify the user API of skore to respect "what you put is what you get" principle #1052

Draft
wants to merge 21 commits into
base: main
Choose a base branch
from

Conversation

thomass-dev
Copy link
Collaborator

@thomass-dev thomass-dev commented Jan 7, 2025

Closes #1045 .


  • hide item API
    • hide put_item
    • hide get_item
    • change get_item_versions to be item agnostic
    • change the constructor of the Project to hide repositories
  • update each item classes to return their original objects
    • cross validation reporter
  • update put to allow the new parameter display_as
  • hide view API
  • move repr_html to reporters

@thomass-dev thomass-dev force-pushed the what-you-put-is-what-you-get branch from afd8291 to 666f094 Compare January 7, 2025 14:52
@thomass-dev thomass-dev force-pushed the what-you-put-is-what-you-get branch from 06ff76f to 0277edb Compare January 7, 2025 15:46
@thomass-dev thomass-dev force-pushed the what-you-put-is-what-you-get branch from c1b9341 to f4552e9 Compare January 7, 2025 15:56
@tuscland tuscland added this to the Skore 0.7 milestone Jan 7, 2025
@glemaitre glemaitre requested review from glemaitre and removed request for glemaitre January 8, 2025 09:59
@glemaitre
Copy link
Member

glemaitre commented Jan 8, 2025

I think that this PR will also close:

@thomass-dev I let you amend your summary if it is the case.

Co-authored-by: Auguste Baum <auguste@probabl.ai>

commit 86281ca
Author: Auguste Baum <auguste@probabl.ai>
Date:   Wed Jan 8 12:00:46 2025 +0100

    mob next [ci-skip] [ci skip] [skip ci]

    lastFile:skore/tests/integration/ui/test_ui.py

commit 9f6f193
Author: Thomas S <thomas@probabl.ai>
Date:   Wed Jan 8 11:52:12 2025 +0100

    mob next [ci-skip] [ci skip] [skip ci]

    lastFile:skore/tests/integration/ui/test_ui.py

commit cd385f6
Author: Auguste Baum <auguste@probabl.ai>
Date:   Wed Jan 8 11:41:10 2025 +0100

    mob next [ci-skip] [ci skip] [skip ci]

    lastFile:skore/src/skore/persistence/item/sklearn_base_estimator_item.py

commit 41c5355
Author: Thomas S <thomas@probabl.ai>
Date:   Wed Jan 8 11:27:16 2025 +0100

    mob next [ci-skip] [ci skip] [skip ci]

    lastFile:skore/tests/integration/sklearn/test_cross_validate.py

commit a7d956e
Author: Auguste Baum <auguste@probabl.ai>
Date:   Wed Jan 8 11:14:59 2025 +0100

    mob next [ci-skip] [ci skip] [skip ci]

    lastFile:skore/tests/unit/view/test_view_repository.py

commit 38446cf
Author: Thomas S <thomas@probabl.ai>
Date:   Wed Jan 8 11:01:43 2025 +0100

    mob next [ci-skip] [ci skip] [skip ci]

    lastFile:skore/src/skore/persistence/item/pickle_item.py

commit a6e2a79
Author: Thomas S <thomas@probabl.ai>
Date:   Wed Jan 8 10:51:07 2025 +0100

    mob start [ci-skip] [ci skip] [skip ci]

Co-authored-by: Auguste Baum <auguste@probabl.ai>
@thomass-dev thomass-dev force-pushed the what-you-put-is-what-you-get branch from 83747f7 to aff2a5f Compare January 8, 2025 11:25
@thomass-dev thomass-dev self-assigned this Jan 10, 2025
# Conflicts:
#	skore/src/skore/project/create.py
#	skore/tests/unit/project/test_project.py
@thomass-dev thomass-dev force-pushed the what-you-put-is-what-you-get branch from a02785f to 862dc49 Compare January 10, 2025 09:22
@thomass-dev thomass-dev force-pushed the what-you-put-is-what-you-get branch from e3d0aa8 to 80df8db Compare January 10, 2025 14:15
Copy link
Contributor

github-actions bot commented Jan 10, 2025

Coverage

Coverage Report for backend
FileStmtsMissCoverMissing
venv/lib/python3.12/site-packages/skore
   __init__.py120100% 
   __main__.py8180%19
   exceptions.py30100% 
venv/lib/python3.12/site-packages/skore/cli
   __init__.py50100% 
   cli.py33385%104, 111, 117
   color_format.py43390%35–>40, 41–43
   launch_dashboard.py261539%36–57
   quickstart_command.py14750%37–51
venv/lib/python3.12/site-packages/skore/persistence
   __init__.py00100% 
venv/lib/python3.12/site-packages/skore/persistence/item
   __init__.py50489%91, 94–97
   cross_validation_reporter_item.py1071388%29–42, 64, 142–143, 267, 270
   item.py421369%91, 94, 98–118
   media_item.py75495%16–19
   numpy_array_item.py25193%15
   pandas_dataframe_item.py34195%15
   pandas_series_item.py34195%15
   pickle_item.py170100% 
   polars_dataframe_item.py32194%15
   polars_series_item.py27194%15
   primitive_item.py27292%13–15
   sklearn_base_estimator_item.py33195%15
   skrub_table_report_item.py10186%11
venv/lib/python3.12/site-packages/skore/persistence/repository
   __init__.py30100% 
   item_repository.py52590%14–15, 188–189, 210
   view_repository.py16283%8–9
venv/lib/python3.12/site-packages/skore/persistence/storage
   __init__.py40100% 
   abstract_storage.py22195%130
   disk_cache_storage.py33195%44
   in_memory_storage.py200100% 
venv/lib/python3.12/site-packages/skore/persistence/view
   __init__.py00100% 
   view.py50100% 
venv/lib/python3.12/site-packages/skore/project
   __init__.py30100% 
   create.py52888%116–122, 132–133, 140–141
   load.py22388%45–47
   open.py140100% 
   project.py39195%11
venv/lib/python3.12/site-packages/skore/sklearn
   __init__.py40100% 
   _base.py141298%168–>173, 184–185
   find_ml_task.py35195%41–>49, 50
   types.py20100% 
venv/lib/python3.12/site-packages/skore/sklearn/_estimator
   __init__.py100100% 
   metrics_accessor.py198298%131, 267
   report.py107098%160–>166, 168–>170
   utils.py11110%1–19
venv/lib/python3.12/site-packages/skore/sklearn/_plot
   __init__.py40100% 
   precision_recall_curve.py126297%200–>203, 313–314
   prediction_error.py75099%289–>297
   roc_curve.py95394%156, 167–>170, 223–224
   utils.py770100% 
venv/lib/python3.12/site-packages/skore/sklearn/cross_validation
   __init__.py20100% 
   cross_validation_helpers.py47490%104–>136, 123–126
   cross_validation_reporter.py35195%177
venv/lib/python3.12/site-packages/skore/sklearn/cross_validation/plots
   __init__.py00100% 
   compare_scores_plot.py292416%10, 28–116
   timing_plot.py292417%10, 26–123
venv/lib/python3.12/site-packages/skore/sklearn/train_test_split
   __init__.py00100% 
   train_test_split.py36294%16–17
venv/lib/python3.12/site-packages/skore/sklearn/train_test_split/warning
   __init__.py80100% 
   high_class_imbalance_too_few_examples_warning.py17378%16–18, 80
   high_class_imbalance_warning.py18288%16–18
   random_state_unset_warning.py11187%15
   shuffle_true_warning.py9091%44–>exit
   stratify_is_set_warning.py11187%15
   time_based_column_warning.py22189%17, 69–>exit
   train_test_split_warning.py5180%21
venv/lib/python3.12/site-packages/skore/ui
   __init__.py00100% 
   app.py25571%24, 53–58
   dependencies.py7186%12
   project_routes.py500100% 
venv/lib/python3.12/site-packages/skore/utils
   __init__.py00100% 
   _accessor.py70100% 
   _logger.py21484%14–18
   _show_versions.py310100% 
TOTAL224718891% 

Tests Skipped Failures Errors Time
425 3 💤 0 ❌ 0 🔥 41.043s ⏱️

@thomass-dev thomass-dev force-pushed the what-you-put-is-what-you-get branch from c0ad30c to c8f3ecf Compare January 13, 2025 14:30
@thomass-dev thomass-dev force-pushed the what-you-put-is-what-you-get branch 2 times, most recently from 510bfa1 to 6255ada Compare January 13, 2025 17:01
@thomass-dev thomass-dev force-pushed the what-you-put-is-what-you-get branch from 6255ada to 4d08a19 Compare January 13, 2025 17:06
for plot_name, plot in dataclasses.asdict(plots).items()
}

#
Copy link
Contributor

@augustebaum augustebaum Jan 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe "Serialize cross-validation settings"

Comment on lines +206 to +207
# add reporter as cached property
instance.reporter = reporter
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since CrossValidationReporterItem is never manipulated by users now, I don't think this is necessary

return {
name: plotly.io.from_json(plot_bytes.decode("utf-8"))
for name, plot_bytes in self.plots_bytes.items()
#
Copy link
Contributor

@augustebaum augustebaum Jan 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I'm starting to think the empty comment is intentional. If it is maybe you can add a description of what is happening, e.g. here "Pack information into dict"?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it was intentional and i have forgotten to ask you the best line to describe the blocks.

@thomass-dev thomass-dev force-pushed the what-you-put-is-what-you-get branch from 120bff0 to 43a296b Compare January 14, 2025 14:35
Conflicts:
	skore/src/skore/item/cross_validation_item.py
	skore/src/skore/project/project.py
	skore/tests/unit/project/test_project.py
@thomass-dev thomass-dev force-pushed the what-you-put-is-what-you-get branch from ec9651e to 4ede134 Compare January 14, 2025 15:18
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.

feat: As a user, i want to retrieve a CrossValidationReporter from a project
4 participants