We will proceed with the recipe as follows:
- 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()
- 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 = 'https://archive.ics.uci.edu/ml/machine-learning-databases/housing/housing.data' 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 ...