Python3-Naive Bayes-使用CountVectorizer报错UnicodeDecodeError: ‘utf8’ codec can’t decode byte…
错误原因
some non-ascii character in the dictionary and it can’t be encoded/decoded
解决方案
load data时添加encoding= ‘unicode_escape’, decode_error=‘ignore’
sklearn.datasets.load_files ("path", categories=categories, shuffle=True, encoding= 'unicode_escape', decode_error='ignore', random_state=42)