From the course: Data Science on Google Cloud Platform: Predictive Analytics

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Build and test model locally

Build and test model locally - Google Cloud Tutorial

From the course: Data Science on Google Cloud Platform: Predictive Analytics

Start my 1-month free trial

Build and test model locally

- [Instructor] In this video we will build and test a buying propensity model, locally. When we say locally, we can either do it on our laptop, or we can use some compute VMs on GCP to run the same. We won't be using Cloud ML yet. We do this locally, since model building is an iterative process, and we do not want to use expensive Cloud ML resources for this work. I'm going to use the Cloud Shell for the model-building effort. The code for this is available under propensity-local.py. Let us review the code. The code reads the web-browsing-data.csv file in line number 12. Then, it prints the details of the file. It filters the predictive variables to contain only reviews, bought together, compare similar, warranty, and sponsored links in line number 19. It also sets the target to the BUY variable. Data is split into training and testing datasets in line number 23. It then uses the naive_bayes algorithm to perform the prediction. Prediction results are printed from line 39 onwards. Let…

Contents