favetelinguis (14) [Avatar] Offline
#1
For the regression example in ch3
from keras.datasets import boston_housing
returns
ImportError: cannot import name boston_housing

And I can not find that such a dataset is included according to the docs?

https://keras.io/datasets/
yad (1) [Avatar] Offline
#2
It seems to be there now:

https://keras.io/datasets/#boston-housing-price-regression-dataset

Make sure the version is updated to the latest:

In [6]: keras.__version__
Out[6]: '2.0.1'

In [7]: from keras.datasets import boston_housing

In [8]: (x_train, y_train), (x_test, y_test) = boston_housing.load_data()

In [9]: x_train
Out[9]:
array([[  1.23247000e+00,   0.00000000e+00,   8.14000000e+00, ...,
          2.10000000e+01,   3.96900000e+02,   1.87200000e+01],
       [  2.17700000e-02,   8.25000000e+01,   2.03000000e+00, ...,
          1.47000000e+01,   3.95380000e+02,   3.11000000e+00],
       [  4.89822000e+00,   0.00000000e+00,   1.81000000e+01, ...,
          2.02000000e+01,   3.75520000e+02,   3.26000000e+00],
       ...,
       [  3.46600000e-02,   3.50000000e+01,   6.06000000e+00, ...,
          1.69000000e+01,   3.62250000e+02,   7.83000000e+00],
       [  2.14918000e+00,   0.00000000e+00,   1.95800000e+01, ...,
          1.47000000e+01,   2.61950000e+02,   1.57900000e+01],
       [  1.43900000e-02,   6.00000000e+01,   2.93000000e+00, ...,
          1.56000000e+01,   3.76700000e+02,   4.38000000e+00]])

In [10]: y_train
Out[10]:
array([ 18.72,   3.11,   3.26,   8.01,  14.65,  11.74,  23.6 ,  26.42,
        16.65,  34.41,  20.31,  34.37,  14.69,  14.19,  27.26,  20.62,