The default value of gamma will change from 'auto' to 'scale' in version 0.22 to account better for unscaled features.


實現《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)

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM