- 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
推薦閱讀
- JavaScript前端開發(fā)模塊化教程
- Python程序設(shè)計教程(第2版)
- Manga Studio Ex 5 Cookbook
- Neo4j Essentials
- Mastering Python High Performance
- SAS數(shù)據(jù)統(tǒng)計分析與編程實(shí)踐
- Python Data Analysis(Second Edition)
- PLC編程與調(diào)試技術(shù)(松下系列)
- The DevOps 2.5 Toolkit
- 軟件測試實(shí)用教程
- Service Mesh實(shí)戰(zhàn):基于Linkerd和Kubernetes的微服務(wù)實(shí)踐
- Go語言編程
- Python預(yù)測分析實(shí)戰(zhàn)
- Responsive Web Design with jQuery
- React and React Native