vetiver.plot_metrics#

vetiver.plot_metrics(df_metrics, date='index', estimate='estimate', metric='metric', n='n', **kw) plotly.express._chart_types.line#

Plot metrics over a given time period

Parameters
  • df_metrics (DataFrame) – Pandas dataframe of metrics over time, such as created by compute_metircs()

  • date (str) – Column in df_metrics containing dates

  • estimate (str) – Column in df_metrics containing metric output

  • metric (str) – Column in df_metrics containing metric name

  • n (str) – Column in df_metrics containing number of observations

Example

>>> import vetiver
>>> import pandas as pd
>>> df = pd.DataFrame(
... {'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}}
... )
>>> plot = vetiver.plot_metrics(
...     df_metrics = df,
...     date = "index",
...     estimate = "estimate",
...     metric = "metric",
...     n = "n")
>>> plot.show()