0A03 Unsupervised Learning: Support Vector Machines

Advantages: Data for the number of small samples and high dimensional feature

Goal: to achieve the purpose of binary classification

Select Hyperplane basis:

  Unable to find other methods to draw the greater the distance between the two dashed lines

  Its optimal hyperplane to the nearest point of the two types of data at the same distance

Spacing problem

  Hard interval: may appear over-fitting phenomenon

  Soft Margin: Allows training has some error

Linearly inseparable problem can be solved

  L-dimensional mapping of high-dimensional space to solve the problem

Kernel:

  Victoria is from low to high-dimensional mapping function

  The most common core is: a Gaussian kernel

Combat:

from sklearn Import SVM      # Import SVM bag 

X- = [[0,0], [2,2 &], [3,3], [4,4 &]]            # of training data 
Y = [1,2,3,4 ] 

CLF svm.SVC = (Kernel = " RBF " , Gamma = ' Auto ' ) # initialization using radial basis classifier 
clf.fit (X-, Y)                 # training 

T = [[2,1], [0,1 ]]            # test set 
Print (clf.predict (T))
 Print (clf.decision_function (T))      # returns to the test data set from the hyperplane

Concern is decision_function () function call codes Finally, it returns the data set from the hyperplane expressed by the positive and negative side of the hyperplane in which, as the absolute value of the distance, the reliability of the classification higher.

Guess you like

Origin www.cnblogs.com/liu247/p/11070191.html
Recommended