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

docs: Minor changes in the doc (tracking items example) #1125

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions examples/getting_started/plot_skore_product_tour.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,10 @@
# import time
#
# my_project.put("my_int", 4)
#
# time.sleep(0.1)
# my_project.put("my_int", 9)
#
# time.sleep(0.1)
# my_project.put("my_int", 16)
#
Expand Down
26 changes: 14 additions & 12 deletions examples/getting_started/plot_tracking_items.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@
import time

my_project.put("my_int", 4)

time.sleep(0.1)
my_project.put("my_int", 9)

time.sleep(0.1)
my_project.put("my_int", 16)

Expand Down Expand Up @@ -73,17 +75,17 @@
# We retrieve the history of the ``my_int`` item:

# %%
item_histories = my_project.get_item_versions("my_int")
item_versions = my_project.get_item_versions("my_int")

# %%
# We can print the first history (first iteration) of this item:
# We can print the details of the first version of this item:

# %%
passed_item = item_histories[0]
print(passed_item)
print(passed_item.primitive)
print(passed_item.created_at)
print(passed_item.updated_at)
first_item = item_versions[0]
print(first_item)
print(first_item.primitive)
print(first_item.created_at)
print(first_item.updated_at)

# %%
# Let us construct a dataframe with the values and last updated times:
Expand All @@ -93,7 +95,7 @@
import pandas as pd

list_primitive, list_created_at, list_updated_at = zip(
*[(elem.primitive, elem.created_at, elem.updated_at) for elem in item_histories]
*[(elem.primitive, elem.created_at, elem.updated_at) for elem in item_versions]
)

df_track = pd.DataFrame(
Expand All @@ -103,7 +105,7 @@
"updated_at": list_updated_at,
}
)
df_track.insert(0, "iteration_number", np.arange(len(df_track)))
df_track.insert(0, "version_number", np.arange(len(df_track)))
df_track

# %%
Expand All @@ -123,7 +125,7 @@

fig = px.line(
df_track,
x="iteration_number",
x="version_number",
y="primitive",
hover_data=df_track.columns,
markers=True,
Expand All @@ -137,8 +139,8 @@
# example.

# %%
# Here, we focused on `how` to use skore's tracking of history of items.
# But `why` track items?
# Here, we focused on *how* to use skore's tracking of history of items.
# But *why* track items?
#
# * We could track some items such as machine learning scores over time to better
# understand which feature engineering works best.
Expand Down
Loading