脑子经常短路,就把看到的随手给记录下,以防后续查看使用:
score = []
gamma_range = np.logspace(-10, 1, 50)
for i in gamma_range:
clf = SVC(kernel='rbf', gamma = i, cache_size=5000).fit(Xtrain, Ytrain)
score.append(slf.score(Xtest, Ytest))
print(max(score), gamma_range[score.index(max(score))])
plt.plot(gamma_range, score)
plt.show()
网友评论