probabl-ai / skore

Skore lets you "Own Your Data Science." It provides a user-friendly interface to track and visualize your modeling results, and perform evaluation of your machine learning models with scikit-learn.
https://probabl.ai
MIT License
46 stars 0 forks source link

Extend the API by creating magic function that can be used in notebooks and ipython #422

Open glemaitre opened 2 weeks ago

glemaitre commented 2 weeks ago

I'm wondering if there is a plan to create a set of magic functions that could be used in a notebook cell to store the items.

Basically, instead of having something like:

x = np.linspace(0, 2, 100)

fig, ax = plt.subplots(figsize=(5, 2.7), layout="constrained")
ax.plot(x, x, label="linear")
ax.set(xlabel="x label", ylable="y label", title="Simple Plot")
ax.legend()
plt.show()

project.put("my_figure", fig)

I would have

%put
x = np.linspace(0, 2, 100)

fig, ax = plt.subplots(figsize=(5, 2.7), layout="constrained")
ax.plot(x, x, label="linear")
ax.set(xlabel="x label", ylable="y label", title="Simple Plot")
ax.legend()
plt.show()

with the expectation that the output of the cell is what will be rendered. Similarly for a markdown cell:

%put
# Markdown title

This is a description that is only text and show be rendered as such.

Under the hood, I can imagine that %put can just pass to MediaItem.factory with a conversion from markdown to HTML. The nice part is that the notebook is already giving you the info that this is the a markdown cell.

The rational behind this question is that if I am a data scientist that want to quickly create a report, I can just add %put in the cells that I am interested to export and get already a report without the need to clean all my notebook.

MarieS-WiMLDS commented 1 week ago

hello Guillaume! Thank you for this feedback and idea! I've added your feedback in our notion where we centralize feedbacks from github, discord, and collected by any other medium. We will review it and prioritize according to our vision.

I like the idea because it allows integration in existing notebooks (e.g. your rationale). Yet, it is something that can be misleading because it's not something that can be used in python script.

I will leave this issue open to allow for discussions.