Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 19 additions & 5 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:

jobs:
tests:
name: "Tests"
name: "Docs"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -20,20 +20,34 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -e .[dev,torch]
python -m pip install -e .[dev]
- name: build docs
run: |
cd docs
make html
make docs
- name: save docs
uses: actions/upload-artifact@v3
with:
name: docs-html
path: docs/_build/html/
- name: publish docs
- name: publish dev docs
if: github.ref_name == 'main' && github.ref_type == 'branch'
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/_build/*
publish_branch: gh-pages
destination_dir: main
- name: publish stable docs
if: github.ref_type == 'tag' && startswith(github.ref, 'refs/tags/v')
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/_build/*
publish_branch: gh-pages
destination_dir: github.ref_name
- name: create symlink stable to new version
if: github.ref_type == 'tag' && startswith(github.ref, 'refs/tags/v')
run: |
rm stable
ln -s "${{ github.ref_name }}" stable
ls -la
2 changes: 1 addition & 1 deletion .github/workflows/weekly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
workflow_dispatch:
schedule:
# At 00:00 on Monday
- cron: 0 0 * * MON
- cron: "0 0 * * MON"

jobs:
vetiver_main_pins_main:
Expand Down
2 changes: 1 addition & 1 deletion docs/source/advancedusage/custom_handler.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This example shows a custom handler of `newmodeltype` type.
from vetiver.handlers.base import BaseHandler

class CustomHandler(BaseHandler):
def __init__(model, ptype_data):
def __init__(self, model, ptype_data):
super().__init__(model, ptype_data)

model_type = staticmethod(lambda: newmodeltype)
Expand Down
7 changes: 4 additions & 3 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,14 @@ You can install the released version of vetiver from `PyPI <https://pypi.org/pro

.. code-block:: bash

pip install vetiver
python -m pip install vetiver

And the development version from `GitHub <https://github.com/rstudio/vetiver-python>`_ with:

.. code-block:: bash

python -m pip install git+https://github.com/rstudio/vetiver-python


This website documents the public API of Vetiver (for Python). See `vetiver.rstudio.com <https://vetiver.rstudio.com>`_ for
more on how to get started.

Expand All @@ -36,7 +35,8 @@ Version
:caption: Version

~VetiverModel
~pin_read_write.vetiver_pin_write
~vetiver_pin_write
~vetiver_create_ptype

Deploy
==================
Expand All @@ -52,6 +52,7 @@ Deploy
~predict
~write_app
~write_docker
~deploy_rsconnect

Monitor
==================
Expand Down
3 changes: 1 addition & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
[metadata]
name = vetiver
version = 0.1.5
description = Deploy models into REST endpoints
long_description = file: README.md
long_description_content_type = text/markdown
Expand Down Expand Up @@ -44,7 +43,7 @@ dev =
pytest-snapshot
sphinx
sphinx-autodoc-typehints
sphinx-book-theme
sphinx-book-theme==0.3.3
myst-parser

torch =
Expand Down
2 changes: 1 addition & 1 deletion vetiver/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from .attach_pkgs import * # noqa
from .meta import * # noqa
from .write_docker import write_docker # noqa
from .write_fastapi import write_app # noqa
from .write_fastapi import write_app, vetiver_write_app # noqa
from .handlers.base import BaseHandler, create_handler, InvalidModelError # noqa
from .handlers.sklearn import SKLearnHandler # noqa
from .handlers.torch import TorchHandler # noqa
Expand Down
18 changes: 11 additions & 7 deletions vetiver/monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,17 @@ def compute_metrics(

Example
-------
from sklearn import metrics
rng = pd.date_range("1/1/2012", periods=10, freq="S")
new = dict(x=range(len(rng)), y = range(len(rng)))
df = pd.DataFrame(new, index = rng).reset_index(inplace=True)
td = timedelta(seconds = 2)
metric_set = [sklearn.metrics.mean_squared_error, sklearn.metrics.mean_absolute_error]
compute_metrics(df, "index", td, metric_set=metric_set, truth="x", estimate="y")
>>> from sklearn.metrics import mean_squared_error, mean_absolute_error
>>> df = pd.DataFrame(
... {
... "index": ["2021-01-01", "2021-01-02", "2021-01-03"],
... "truth": [200, 201, 199],
... "pred": [198, 200, 199],
... }
... )
>>> td = timedelta(days = 1)
>>> metric_set = [mean_squared_error, mean_absolute_error]
>>> metrics = compute_metrics(df, "index", td, metric_set, "truth", "pred")

"""

Expand Down