Used a with statement instead of a close statement for robustness.
@@ -25,10 +25,9 @@ def load_data(path='boston_housing.npz', test_split=0.2, seed=113):
path = get_file(path,
origin='https://s3.amazonaws.com/keras-datasets/boston_housing.npz',
file_hash='f553886a1f8d56431e820c5b82552d9d95cfcb96d1e678153f8839538947dff5')
- f = np.load(path)
+ with np.load(path) as f:
x = f['x']
y = f['y']
- f.close()
np.random.seed(seed)
indices = np.arange(len(x))
