Today, I will go on the journey of machine learning.
2. Supervised learning: classification and regression
In classification, the label is discrete, while in regression, the label is continuous.
2.1 classification
K nearest neighbors(kNN) is one of the simplest learning strategies: given a new, unknown observation, look up in your reference database which ones have the closest features and assign the predominant class.
from sklearn import neighbors, datasets
iris = datasets.load_iris()
X, y = iris.data, iris.target
knn = neighbors.KNeighborsClassifier(n_neighbors = 1)
knn.fit(X, y)
print(iris.target_names[knn.predict([[3,5,4,2]])])
output:['virginica']

Figure 1. A plot of the sepal space and the prediction of the KNN.png
2.2 regression
The simplest possible regression setting is the linear regression one:

Figure 2. A plot of a simple linear regression.png
(I have studied this two types in previous days, umumum...)
这部分内容,也是概述性的,之前学习过类似的内容,算是复习吧。。。

Figure 3. Simple versus complex models for classification.png