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.github.io/skore/
MIT License
67 stars 7 forks source link

grid search result API #715

Open adrinjalali opened 3 days ago

adrinjalali commented 3 days ago

In the intro example we have:

# %%
import pandas as pd

df = pd.DataFrame(gs_cv.cv_results_)
df.insert(len(df.columns), "rmse", -df["mean_test_score"].values)
df[["param_alpha", "rmse"]].head()

# %%
import matplotlib.pyplot as plt

fig = plt.figure(layout="constrained", dpi=200)
plt.plot(df["param_alpha"], df["rmse"])
plt.xscale("log")
plt.xlabel("Alpha hyperparameter")
plt.ylabel("RMSE")
plt.title("Ridge regression")
plt.show()

# %%
# |
# Finally, we store some relevant information to our skore project, so that we
# can visualize them later in the skore UI for example:

# %%
my_project.put("my_gs_cv", gs_cv)
my_project.put("my_df", df)
my_project.put("my_fig", fig)

I would have expected this to be more like:

my_project.pu("GS Results", gs_cv.cv_results_, type="cv_results")

kinda thing which then does all the magic for me. Also, we don't really need to translate the "neg_root_mean_squared_error".

augustebaum commented 2 days ago

Side-note: the hypothetical type argument is the kind of stuff that makes me think using **kwargs to put several things at a time is not great (see #718)

adrinjalali commented 2 days ago

you can always do

def put(_type, / , **kwargs):
rouk1 commented 1 day ago

Related to #731