- Machine Learning for OpenCV
- Michael Beyeler
- 167字
- 2021-07-02 19:47:24
Loading the dataset
We can again thank scikit-learn for easy access to the dataset. We first import all the necessary modules, as we did earlier:
In [1]: import numpy as np
... from sklearn import datasets
... from sklearn import metrics
... from sklearn import model_selection as modsel
... from sklearn import linear_model
... %matplotlib inline
... import matplotlib.pyplot as plt
... plt.style.use('ggplot')
Then, loading the dataset is a one-liner:
In [2]: boston = datasets.load_boston()
The structure of the boston object is identical to the iris object, as discussed in the preceding command. We can get more information about the dataset in 'DESCR', find all data in 'data', all feature names in 'feature_names', and all target values in 'target':
In [3]: dir(boston)
Out[3]: ['DESCR', 'data', 'feature_names', 'target']
The dataset contains a total of 506 data points, each of which has 13 features:
In [4]: boston.data.shape
Out[4]: (506, 13)
Of course, we have only a single target value, which is the housing price:
In [5]: boston.target.shape
Out[5]: (506,)
推薦閱讀
- 控糖控脂健康餐
- Django Design Patterns and Best Practices
- Blender 3D Incredible Machines
- iOS應用逆向工程(第2版)
- QGIS:Becoming a GIS Power User
- Yocto for Raspberry Pi
- Python算法詳解
- 輕松上手2D游戲開發:Unity入門
- 零基礎學Kotlin之Android項目開發實戰
- JavaScript程序設計(第2版)
- Practical Microservices
- Python Linux系統管理與自動化運維
- INSTANT PLC Programming with RSLogix 5000
- Learning GraphQL and Relay
- Python Natural Language Processing