Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
sylvaincom committed Jan 15, 2025
1 parent 15055aa commit 8b8f50e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
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

0 comments on commit 8b8f50e

Please sign in to comment.