Skip to main content

layer.Model

class Model

Provides access to ML models trained and stored in Layer.

You can retrieve an instance of this object with layer.get_model().

This class should not be initialized by end-users.

# Fetches a specific version of this model
layer.get_model("churn_model:1.2")

get_metadata()

Get logged data associated with this model and having the given tag. If the logged data is an image, then you can also pass a value for the step parameter.

  • Parameters

    • tag (str) --
    • step (Optional[int**]) --
  • Return type

    LoggedDataObject

get_train()

Returns the trained and saved model artifact. For example, a scikit-learn or PyTorch model object.

  • Returns

    The trained model artifact.

  • Return type

    ModelObject

log()

Log data for a particular (i.e. non-latest) model train.

For more details about logging in general, please look at layer.log() documentation.

  • Parameters

    • data (Mapping[str, Union[str, float, bool, int, List[Any], np.ndarray[Any, Any], Dict[str, Any], pandas.DataFrame, PIL.Image.Image, matplotlib.figure.Figure, matplotlib.axes._subplots.AxesSubplot, Image, module, Path, Markdown]**]) --
    • step (Optional[int**]) --
    • category (Optional[str**]) --
  • Return type

    None

predict()

Performs prediction on the input dataframe data. :return: the predictions as a pd.DataFrame

  • Parameters

    input_df (DataFrame) --

  • Return type

    DataFrame