import vetiver
import pandas as pd
# Example data
= 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}}
)
= vetiver.plot_metrics(
plot = df,
df_metrics = "index",
date = "estimate",
estimate = "metric",
metric = "n")
n
plot.show()
plot_metrics
**kw) plot_metrics(df_metrics, date, estimate, metric, n,
Plot metrics over a given time period
Parameters
df_metrics : DataFrame
-
Pandas dataframe of metrics over time, such as created by
compute_metrics()
date : = 'index'
-
Name of column in
df_metrics
containing dates estimate : = 'estimate'
-
Name of column in
df_metrics
containing metric output metric : = 'metric'
-
Name of column in
df_metrics
containing metric name n : = 'n'
-
Name of column in
df_metrics
containing number of observations
Returns
: plotly.express.line
-
A plotly line plot is returned with metrics over time
Examples
First, we will set up some example data.