实现《python数据科学手册》代码时出现如下警告:

py:196: FutureWarning: The default value of gamma will change from 'auto' to 'scale' in version 0.22 to account better for unscaled features. Set gamma explicitly to 'auto' or 'scale' to avoid this warning.
  "avoid this warning.", FutureWarning

出现该警告的源码如下:

clf = SVC(kernel='rbf', C=1E6)
clf.fit(X, y)

解决方案:

根据 warning 的提示,在 C=1E6 后加上 , gamma='auto', 即

clf = SVC(kernel='rbf', C=1E6, gamma='auto')
clf.fit(X, y)

 

相关文章:

  • 2021-09-07
  • 2022-12-23
  • 2022-02-28
  • 2021-06-20
  • 2021-09-21
  • 2021-11-23
  • 2021-08-04
猜你喜欢
  • 2022-12-23
  • 2021-09-09
  • 2022-12-23
  • 2021-12-25
  • 2022-02-11
  • 2022-12-23
相关资源
相似解决方案