【机器学习】SVM支持向量机
from sklearn . datasets import make_circles from sklearn . svm import SVC import matplotlib . pyplot as plt from mpl_toolkits . mplot3d import Axes3D from sklearn . linear_model import LogisticRegression import numpy as np #创建样本点 ''' n_samples:创建多少啊个样本 noise :噪音 factor :方差 ''' X , y = make_circles ( noise = .1 , factor = .1 ) plt . scatter ( X [ : , 0 ] , X [ : , 1 ] , c = y ) plt . axis ( 'equal' ) #画轮廓图 x1_min , x1_max = X [ : , 0 ] . min ( ) - 1 , X [ : , 0 ] . max ( ) + 1 x2_min , x2_max = X [ : , 1 ] . min ( ) - 1 , X [ : , 1 ] . max ( ) + 1 x1 = np . linspace ( x1_min , x1_max , 50 ) x2