tf.keras.datasets.boston_housing.load_data
Stay organized with collections
Save and categorize content based on your preferences.
Loads the Boston Housing dataset.
tf.keras.datasets.boston_housing.load_data(
path='boston_housing.npz', test_split=0.2, seed=113
)
This is a dataset taken from the StatLib library which is maintained at
Carnegie Mellon University.
Samples contain 13 attributes of houses at different locations around the
Boston suburbs in the late 1970s. Targets are the median values of
the houses at a location (in k$).
The attributes themselves are defined in the
StatLib website.
Args |
path
|
path where to cache the dataset locally
(relative to ~/.keras/datasets ).
|
test_split
|
fraction of the data to reserve as test set.
|
seed
|
Random seed for shuffling the data
before computing the test split.
|
Returns |
Tuple of Numpy arrays: (x_train, y_train), (x_test, y_test) .
|
x_train, x_test: numpy arrays with shape (num_samples, 13)
containing either the training samples (for x_train),
or test samples (for y_train).
y_train, y_test: numpy arrays of shape (num_samples,)
containing the
target scalars. The targets are float scalars typically between 10 and
50 that represent the home prices in k$.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.
Last updated 2022-10-27 UTC.
[null,null,["Last updated 2022-10-27 UTC."],[],[],null,["# tf.keras.datasets.boston_housing.load_data\n\n|-------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/keras-team/keras/tree/v2.8.0/keras/datasets/boston_housing.py#L23-L76) |\n\nLoads the Boston Housing dataset.\n\n#### View aliases\n\n\n**Compat aliases for migration**\n\nSee\n[Migration guide](https://www.tensorflow.org/guide/migrate) for\nmore details.\n\n[`tf.compat.v1.keras.datasets.boston_housing.load_data`](https://www.tensorflow.org/api_docs/python/tf/keras/datasets/boston_housing/load_data)\n\n\u003cbr /\u003e\n\n tf.keras.datasets.boston_housing.load_data(\n path='boston_housing.npz', test_split=0.2, seed=113\n )\n\nThis is a dataset taken from the StatLib library which is maintained at\nCarnegie Mellon University.\n\nSamples contain 13 attributes of houses at different locations around the\nBoston suburbs in the late 1970s. Targets are the median values of\nthe houses at a location (in k$).\n\nThe attributes themselves are defined in the\n[StatLib website](http://lib.stat.cmu.edu/datasets/boston).\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|--------------|----------------------------------------------------------------------------|\n| `path` | path where to cache the dataset locally (relative to `~/.keras/datasets`). |\n| `test_split` | fraction of the data to reserve as test set. |\n| `seed` | Random seed for shuffling the data before computing the test split. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---|---|\n| Tuple of Numpy arrays: `(x_train, y_train), (x_test, y_test)`. ||\n\n\u003cbr /\u003e\n\n**x_train, x_test** : numpy arrays with shape `(num_samples, 13)`\ncontaining either the training samples (for x_train),\nor test samples (for y_train).\n\n**y_train, y_test** : numpy arrays of shape `(num_samples,)` containing the\ntarget scalars. The targets are float scalars typically between 10 and\n50 that represent the home prices in k$."]]