- 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,)
推薦閱讀
- Vue.js 3.x從入門到精通(視頻教學(xué)版)
- Network Automation Cookbook
- Animate CC二維動(dòng)畫設(shè)計(jì)與制作(微課版)
- HTML5從入門到精通 (第2版)
- Cybersecurity Attacks:Red Team Strategies
- 汽車人機(jī)交互界面整合設(shè)計(jì)
- Exploring SE for Android
- OpenCV Android開發(fā)實(shí)戰(zhàn)
- 零基礎(chǔ)學(xué)C++(升級(jí)版)
- Web開發(fā)的平民英雄:PHP+MySQL
- 零基礎(chǔ)入門Python數(shù)據(jù)分析與機(jī)器學(xué)習(xí)
- Swift語言實(shí)戰(zhàn)晉級(jí)(第2版)
- Boost.Asio C++ Network Programming Cookbook
- Odoo Development Essentials
- vSphere High Performance Cookbook(Second Edition)