在上一篇博客中介绍了数值型数据的预处理但是真实世界的数据集通常都含有分类型变量(categorical value)的特征.当我们讨论分类型数据时,我们不区分其取值是否有序.比如T恤尺寸是有序的,因为XL>L>M.而T恤颜色是无序的.在讲解处理分类数据的技巧之前,我们先创建一个新的DataFrame对象: import pandas as pd from pandas import DataFrame data = {'color':['green','red','blue'], …
Text classifcation with Naïve Bayes In this section we will try to classify newsgroup messages using a dataset that can be retrieved from within scikit-learn. This dataset consists of around 19,000 newsgroup messages from 20 different topics ranging…