svm使用出現FutureWarning: The default value of gamma will change from 'auto' to 'scale' in version 0.22
G:/workspace/Firmware-url-Detection/url_classfication/trainer_zgd.py
C:\Users\zgd\AppData\Roaming\Python\Python27\site-packages\sklearn\svm\base.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)
雖然這個警告資訊並不影響正常結果的輸出,但是看起來讓人覺得很不舒服。於是就想著一個方法把這個警告資訊給去了。
使用下面這兩行程式碼直接解決:
import warnings
warnings.filterwarnings("ignore", category=FutureWarning, module="sklearn", lineno=196)
其中ignore表示忽略這個警告資訊,category表示要忽略的警告資訊的類別,module表示要處理的模組資訊,lineno表示要處理第XX行程式碼出現警告的地方。具體資訊可以參考上面一個截圖,對照修改就行。