使用 python 时,经常出现如下FutureWarning
异常,有时候查了半天也无法解决,然而看着又不舒服。此时,可以将其屏蔽,眼不见心不烦。
py:193: 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)
可用以下代码屏蔽FutureWarning
import warnings
warnings.filterwarnings("ignore", category=FutureWarning, module="sklearn", lineno=193)
- ignore : 忽略这个警告信息,
- category : 要忽略的警告信息的类别
- module : 要处理的模块信息
- lineno : 要处理第XX行代码出现警告的地方