To serve predictions from AI Platform Prediction, you must export your trained machine learning model as one or more artifacts. This guide describes the different ways to export trained models for deployment on AI Platform Prediction.
The following methods of exporting your model apply whether you perform training on AI Platform Prediction or perform training elsewhere and just want to deploy to AI Platform Prediction to serve predictions.
Once you have exported your model, read the guide to deploying models to learn how to create model and version resources on AI Platform Prediction for serving predictions.
from sklearn import datasets
import xgboost as xgb
iris = datasets.load_iris()
dtrain = xgb.DMatrix(iris.data, label=iris.target)
bst = xgb.train({}, dtrain, 20)
bst.save_model('model.bst')
You can use following WML API call to download the content of your model:-
curl -X PUT 'https://us-south.ml.cloud.ibm.com/ml/v4/models/:model_id/content?content_format=<string>&space_id=<string>&project_id=<string>&pipeline_node_id=<string>&name=<string>&version=2020-09-01' --data-raw '"<object>"'
https://cloud.ibm.com/apidocs/machine-learning#models-download-content
style="font-family: arial, helvetica, sans-serif; font-size: 10pt;">You can also use WML Python Client https://wml-api-pyclient-dev-v4.mybluemix.net/#repository
client.repository.download(model_uid, 'my_model.tar.gz')
Alternatively, if you are using deployment space now, You can simply export the space and just select the model that you would like to export. In the exported zip file, you will find the model file under the assets/wml_model/ directory.