How To Export a Python Model#
Introduction#
In this guide you will learn how to export a generic Python model and register it in the Model Registry.
Code#
Step 1: Connect to Hopsworks#
Step 2: Train#
Define your XGBoost model and run the training loop.
Step 3: Export to local path#
Export the XGBoost model to a directory on the local filesystem.
Step 4: Register model in registry#
Use the ModelRegistry.python.create_model(..) function to register a model as a Python model. Define a name, and attach optional metrics for your model, then invoke the save() function with the parameter being the path to the local directory where the model was exported to.
Going Further#
You can attach an Input Example and a Model Schema to your model to document the shape and type of the data the model was trained on.