- 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,)
推薦閱讀
- Visual C++程序設計教程
- 軟件項目估算
- 深入理解Django:框架內幕與實現原理
- Learning Data Mining with Python
- 零基礎學MQL:基于EA的自動化交易編程
- Python漫游數學王國:高等數學、線性代數、數理統計及運籌學
- Maven for Eclipse
- 計算機系統解密:從理解計算機到編寫高效代碼
- C語言程序設計實驗指導
- 邊做邊學深度強化學習:PyTorch程序設計實踐
- Learning C# by Developing Games with Unity 3D Beginner's Guide
- 設計模式之禪
- Getting Started with Phalcon
- Drupal 8 Quick Start Guide
- Java Coding Problems