Skip to content

Commit 1345e84

Browse files
committed
add to api docs
1 parent 6c9c59a commit 1345e84

2 files changed

Lines changed: 20 additions & 9 deletions

File tree

docs/source/index.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,17 @@ Deploy
5353
~write_app
5454
~write_docker
5555

56+
Monitor
57+
==================
58+
59+
.. autosummary::
60+
:toctree: reference/
61+
:caption: Monitor
62+
63+
~compute_metrics
64+
~pin_metrics
65+
~plot_metrics
66+
5667
Advanced Usage
5768
==================
5869
.. toctree::

vetiver/monitor.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def compute_metrics(
1313
metric_set: list,
1414
truth: str,
1515
estimate: str,
16-
):
16+
) -> pd.DataFrame:
1717
"""
1818
Compute metrics for given time period
1919
@@ -23,23 +23,23 @@ def compute_metrics(
2323
Pandas dataframe
2424
date_var:
2525
Column in `data` containing dates
26-
period:
26+
period: datetime.timedelta
2727
Defining period to group by
28-
https://pandas.pydata.org/pandas-docs/stable/user_guide/timeseries.html#offset-aliases
2928
metric_set: list
30-
List of metrics to compute
31-
https://scikit-learn.org/stable/modules/classes.html#module-sklearn.metrics
29+
List of metrics to compute, that have the parameters `y_true` and `y_pred`
3230
truth:
3331
Column name for true results
3432
estimate:
3533
Column name for predicted results
3634
3735
Example
3836
-------
39-
rng = pd.date_range("1/1/2012", periods=100, freq="S")
40-
new = dict(x=range(len(ts)), y = range(len(ts)))
37+
from sklearn import metrics
38+
rng = pd.date_range("1/1/2012", periods=10, freq="S")
39+
new = dict(x=range(len(rng)), y = range(len(rng)))
4140
df = pd.DataFrame(new, index = rng).reset_index(inplace=True)
42-
metric_set = [metrics.mean_squared_error, metrics.mean_absolute_error]
41+
td = timedelta(seconds = 2)
42+
metric_set = [sklearn.metrics.mean_squared_error, sklearn.metrics.mean_absolute_error]
4343
compute_metrics(df, "index", td, metric_set=metric_set, truth="x", estimate="y")
4444
4545
"""
@@ -133,7 +133,7 @@ def pin_metrics(board, df_metrics, metrics_pin_name, overwrite=False):
133133

134134
def plot_metrics(
135135
df_metrics, date="index", estimate="estimate", metric="metric", n="n", **kw
136-
):
136+
) -> px.line:
137137
"""
138138
Plot metrics over a given time period
139139

0 commit comments

Comments
 (0)