VetiverModel

VetiverModel(
    self,
    model,
    model_name: str,
    prototype_data,
    versioned,
    description: str = None,
    metadata: dict = None,
    **kwargs,
)

Create VetiverModel class for serving.

Parameters

model :

A trained model, such as an sklearn or torch model

model_name : string

Model name or ID

prototype_data : (pd.DataFrame, np.array) = None

Sample of data model should expect when it is being served

versioned : = None

Should the model be versioned when created?

description : str = None

A detailed description of the model. If omitted, a brief description will be generated.

metadata : dict = None

Other details to be saved and accessed for serving

kwargs : = {}

Deprecated parameters.

Attributes

prototype : vetiver.Prototype

Data prototype

handler_predict : Callable

Method to make predictions from a trained model

Notes

VetiverModel can also take an initialized custom VetiverHandler as a model, for advanced use cases or non-supported model types. Parameter ptype_data was changed to prototype_data. Handling of ptype_data will be removed in a future version.

Examples

from vetiver import mock, VetiverModel
X, y = mock.get_mock_data()
model = mock.get_mock_model().fit(X, y)
v = VetiverModel(model = model, model_name = "my_model", prototype_data = X)
v.description
'A scikit-learn DummyRegressor model'

Methods

Name Description
from_pin Create VetiverModel from pinned model.

from_pin

VetiverModel.from_pin(board, name: str, version: str = None)

Create VetiverModel from pinned model.

Parameters

board :

pins board where model is located

name : str

Model name inside pins board

version : str = None

What model version should be loaded