- Machine Learning for OpenCV
- Michael Beyeler
- 116字
- 2021-07-02 19:47:25
Inspecting the data
Before you get started with setting up a model, it is always a good idea to have a look at the data. We did this earlier for the town map example, so let's continue our streak. Using Matplotlib, we create a scatter plot where the color of each data point corresponds to the class label:
In [10]: plt.scatter(data[:, 0], data[:, 1], c=target,
cmap=plt.cm.Paired, s=100)
... plt.xlabel(iris.feature_names[0])
... plt.ylabel(iris.feature_names[1])
Out[10]: <matplotlib.text.Text at 0x23bb5e03eb8>
To make plotting easier, we limit ourselves to the first two features (iris.feature_names[0] being the sepal length and iris.feature_names[1] being the sepal width). We can see a nice separation of classes in the following figure:

Plotting the first two features of the Iris dataset
推薦閱讀
- Puppet 4 Essentials(Second Edition)
- Visual C++程序設(shè)計教程
- 從零構(gòu)建知識圖譜:技術(shù)、方法與案例
- Getting Started with ResearchKit
- 軟件測試工程師面試秘籍
- Visual Basic程序設(shè)計(第3版):學(xué)習(xí)指導(dǎo)與練習(xí)
- 基于SpringBoot實現(xiàn):Java分布式中間件開發(fā)入門與實戰(zhàn)
- 現(xiàn)代C++編程實戰(zhàn):132個核心技巧示例(原書第2版)
- Go語言編程
- 零代碼實戰(zhàn):企業(yè)級應(yīng)用搭建與案例詳解
- C語言程序設(shè)計
- INSTANT Apache Maven Starter
- R for Data Science Cookbook
- Python程序設(shè)計案例教程:從入門到機器學(xué)習(xí)(微課版)
- C語言學(xué)習(xí)手冊