In this article we will see how to load Boston Housing Dataset
with tf.keras.dataset
. This module provides some sample datasets
in Numpy format.
For loading Boston Dataset tf.keras provides
tf.keras.datasets.boston_housing.load_data
function, which returns tuples of numpy
arrays
(x_train, y_train), (x_test, y_test).
Load Boston Dataset and print shapes of test and training sets.
import tensorflow as tf
(x_train, y_train), (x_test, y_test) = tf.keras.datasets.boston_housing.load_data(
path="boston_housing.npz", test_split=0.3, seed=85)
print(x_train.shape, y_train.shape)
print(x_test.shape, y_test.shape)
Output
(354, 13) (354,)
(152, 13) (152,)
Similar Articles