How it works...

In steps 1 and 2, we logged in to the Google Cloud portal and navigated to the APIs and services page. These APIs provide user-friendly interfaces for accessing any service from storage to computation and the deployment of applications. Using these APIs, you can automate workflows using a wide variety of programming languages and tools without worrying about hardware and software provisioning. In steps 3 and 4, we enabled the AI Platform Training and Prediction API, which is used for creating machine learning models.

This API enables data enthusiasts to build, deploy, and monitor their machine learning applications seamlessly in a portable and cost-effective manner. In step 5, we installed the cloudML package in R using RStudio and the Google Cloud SDK. This SDK consists of utilities that allow us to interact with our Google Cloud account from within R.

During installation, you need to specify the default account, project, and compute region for Google Cloud; these details are then used for all of your CloudML jobs. In step 6, we provided the Google account details that needed to be linked with the Google Cloud SDK. In step 7, we submitted a deep learning job to perform training on the cloud. A good practice is to first run the scripts locally with smaller data and then submit the job in the cloud once outputs come as expected. In this example, we ran a classification model using the MNIST handwritten digits dataset. To do this, we created an R script with the name mnist_mlp.R and then saved it in the current working directory. The R script is provided in the GitHub repository of this chapter. 

Then, in a new R script, we executed the following code to submit the job to GCP:

library(cloudml)
cloudml_train("mnist_mlp.R")

In the last step, we went to the Google Cloud portal to monitor the job submitted in step 7.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset