How to do it...

We will proceed with the recipe as follows:

  1. First, we will load the necessary libraries and start a graph session:
import matplotlib.pyplot as pltimport numpy as npimport tensorflow as tfimport requestssess = tf.Session() 
  1. Next, we will load the data and store it in a NumPy array. Again, note that we will only use certain columns for prediction. We do not use the id, nor variables that have very low variance:
housing_url = '' housing_header = ['CRIM', 'ZN', 'INDUS', 'CHAS', 'NOX', 'RM', 'AGE', 'DIS', 'RAD', 'TAX', 'PTRATIO', 'B', 'LSTAT', 'MEDV'] cols_used = ['CRIM', 'INDUS', 'NOX', 'RM', 'AGE', 'DIS', 'TAX', 'PTRATIO', 'B', 'LSTAT'] num_features ...

Get TensorFlow Machine Learning Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.