VetiverModel

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

Create VetiverModel class for serving.

Parameters

Name Type Description Default
model A trained model, such as an sklearn or torch model required
model_name string Model name or ID required
prototype_data (pd.DataFrame, np.array) Sample of data model should expect when it is being served None
versioned Should the model be versioned when created? None
description str A detailed description of the model. If omitted, a brief description will be generated. None
metadata dict Other details to be saved and accessed for serving None
**kwargs Deprecated parameters. {}

Attributes

Name Type Description
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, version=None)

Create VetiverModel from pinned model.

Parameters

Name Type Description Default
board pins board where model is located required
name str Model name inside pins board required
version str What model version should be loaded None