vetiver.VetiverModel#

class vetiver.VetiverModel(model, model_name: str, ptype_data=None, versioned=None, description: Optional[str] = None, metadata: Optional[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

  • ptype_data (pd.DataFrame, np.array) – Sample of data model should expect when it is being served

  • versioned – Should the model be versioned when created?

  • description (str) – A detailed description of the model. If omitted, a brief description will be generated.

  • metadata (dict) – Other details to be saved and accessed for serving

ptype#

Data prototype

Type

pydantic.main.BaseModel

handler_predict#

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.

Example

>>> 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", ptype_data = X)
>>> v.description
"Scikit-learn <class 'sklearn.dummy.DummyRegressor'> model"
__init__(model, model_name: str, ptype_data=None, versioned=None, description: Optional[str] = None, metadata: Optional[dict] = None, **kwargs)#

Methods

__init__(model, model_name[, ptype_data, ...])

from_pin(board, name[, version])