pin_metrics
pin_metrics(
board,
df_metrics: pd.DataFrame,str,
metrics_pin_name: str | None = None,
pin_type: str = 'index',
index_name: bool = False,
overwrite: )
Update an existing pin storing model metrics over time
Parameters
board :
-
Pins board
df_metrics : pd.DataFrame
-
Dataframe of metrics over time, such as created by
vetiver_compute_metrics()
metrics_pin_name : str
-
Pin name for where the metrics are stored
index_name : str = 'index'
-
The column in df_metrics containing the aggregated dates or datetimes. Note that this defaults to a column named “index”.
overwrite : bool = False
-
If True, overwrite any metrics for dates that exist both in the existing pin and new metrics with the new values. If False, error when the new metrics contain overlapping dates with the existing pin.
Examples
import pins
import vetiver
= pd.DataFrame(
df 'index': {0: pd.Timestamp('2021-01-01 00:00:00'),
{1: pd.Timestamp('2021-01-01 00:00:00'),
2: pd.Timestamp('2021-01-02 00:00:00'),
3: pd.Timestamp('2021-01-02 00:00:00')},
'n': {0: 1, 1: 1, 2: 1, 3: 1},
'metric': {0: 'mean_squared_error',
1: 'mean_absolute_error',
2: 'mean_squared_error',
3: 'mean_absolute_error'},
'estimate': {0: 4.0, 1: 2.0, 2: 1.0, 3: 1.0}}
)= pins.board_temp()
board "metrics", type = "csv")
board.pin_write(df,
= pd.DataFrame(
df 'index': {0: pd.Timestamp('2021-01-02 00:00:00'),
{1: pd.Timestamp('2021-01-02 00:00:00'),
2: pd.Timestamp('2021-01-03 00:00:00'),
3: pd.Timestamp('2021-01-03 00:00:00')},
'n': {0: 1, 1: 1, 2: 1, 3: 1},
'metric': {0: 'mean_squared_error',
1: 'mean_absolute_error',
2: 'mean_squared_error',
3: 'mean_absolute_error'},
'estimate': {0: 4.0, 1: 6.0, 2: 2.0, 3: 1.0}}
)
vetiver.pin_metrics(=board,
board=df2,
df_metrics="metrics",
metrics_pin_name="index",
index_name=True) overwrite