SVM官方教程:SVR 简易教程
SVR: 简易使用教程 */ /*--> */ */ /*--> */ */ /*--> */ */ /*--> */ SVR 简易教程 ¶ In [1]: import numpy as np from sklearn.svm import SVR import matplotlib.pyplot as plt 构造数据 ¶ In [2]: # Generate sample data X = np.sort(5 * np.random.rand(40, 1), axis=0) y = np.sin(X).ravel() In [3]: # Add noise to targets y[::5] += 3 * (0.5 - np.random.rand(8)) 选择核函数 ¶ In [4]: svr_rbf = SVR(kernel='rbf', C=100, gamma=0.1, epsilon=.1) svr_lin = SVR(kernel='linear', C=100, gamma='auto') svr_poly = SVR(kernel='poly', C=100, gamma='auto', degree=3, epsilon=.1, coef0=1) 技巧:绘图 $linewidths$ 的简易写法 $lw $,这我以前还不知道。 In [11]: lw = 2