plot_metrics
plot_metrics(df_metrics, date='index', estimate='estimate', metric='metric', n='n', **kw)
Plot metrics over a given time period
Parameters
Name | Type | Description | Default |
---|---|---|---|
df_metrics |
DataFrame | Pandas dataframe of metrics over time, such as created by compute_metrics() |
required |
date |
Column in df_metrics containing dates |
'index' |
|
estimate |
Column in df_metrics containing metric output |
'estimate' |
|
metric |
Column in df_metrics containing metric name |
'metric' |
|
n |
Column in df_metrics containing number of observations |
'n' |
Examples
>>> 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,
... df_metrics = "index",
... date = "estimate",
... estimate = "metric",
... metric = "n")
... n >>> plot.show()