You can deploy scikit-learn models trained in Kaggle to AI Platform Prediction for serving predictions at scale.
This AI Adventures episode explains the basic workflow about how to take a model trained anywhere, including Kaggle, and serve online predictions from AI Platform Prediction.
- Train your scikit-learn model on Kaggle. You can see an example in this introduction to scikit-learn. See how to create a notebook kernel on Kaggle.
Save your model using the
sklearn.externals.jobliblibrary, making sure to name the file
model.joblib. Select the Commit & Run button to execute all of your kernel code cells in order. This saves and runs your model training code.
model.joblibfrom your kernel outputs.
model.joblibfile to Cloud Storage.
Create model and version resources on AI Platform Prediction using the Cloud Console, providing information about how you trained your model and where you stored it in Cloud Storage.
Send a prediction request.
Find your model files in Kaggle
You can download your model files from the Output tab in your kernel.
At the main link to your kernel, https://www.kaggle.com/[YOUR-USER-NAME]/[YOUR-KERNEL-NAME]/:
- Select the Output tab at the top of the page.
model.joblibfile appears in a list of Data Sources. To download the file, select the Download All button. Alternatively, hover your mouse over the name of the model, and then select the download icon that appears by the model name.
- View a video introduction to Kaggle Kernels and learn more about the advantages of using Kaggle.
- See how to deploy a model on AI Platform Prediction.
- View the documentation on Kaggle Kernels.