- 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
推薦閱讀
- Data Visualization with D3 4.x Cookbook(Second Edition)
- AngularJS Testing Cookbook
- 自己動手寫搜索引擎
- Java程序設計實戰教程
- Python語言程序設計
- 程序員面試算法寶典
- 深入淺出Prometheus:原理、應用、源碼與拓展詳解
- 新手學Visual C# 2008程序設計
- Functional Kotlin
- Go并發編程實戰
- Java程序設計案例教程
- 會當凌絕頂:Java開發修行實錄
- Xamarin Cross-Platform Development Cookbook
- 編程風格:程序設計與系統構建的藝術(原書第2版)
- Implementing DevOps with Ansible 2