1. 程式人生 > >20 Newsgroups資料集介紹

20 Newsgroups資料集介紹

20newsgroups資料集是用於文字分類、文字挖據和資訊檢索研究的國際標準資料集之一。資料集收集了大約20,000左右的新聞組文件,均勻分為20個不同主題的新聞組集合。一些新聞組的主題特別相似(e.g. comp.sys.ibm.pc.hardware/ comp.sys.mac.hardware),還有一些卻完全不相關 (e.g misc.forsale /soc.religion.christian)。

comp.graphics
comp.os.ms-windows.misc
comp.sys.ibm.pc.hardware
comp.sys.mac.hardware
comp.windows.x

rec.autos
rec.motorcycles
rec.sport.baseball
rec.sport.hockey

sci.crypt
sci.electronics
sci.med
sci.space

misc.forsale

talk.politics.misc
talk.politics.guns
talk.politics.mideast

talk.religion.misc
alt.atheism
soc.religion.christian

20newsgroups資料集有三個版本。第一個版本19997是原始的並沒有修改過的版本。第二個版本bydate是按時間順序分為訓練(60%)和測試(40%)兩部分資料集,不包含重複文件和新聞組名(新聞組,路徑,隸屬於,日期)。第三個版本18828不包含重複文件,只有來源和主題。

在sklearn中,該模型有兩種裝載方式,第一種是sklearn.datasets.fetch_20newsgroups,返回一個可以被文字特徵提取器(如sklearn.feature_extraction.text.CountVectorizer)自定義引數提取特徵的原始文字序列;第二種是sklearn.datasets.fetch_20newsgroups_vectorized,返回一個已提取特徵的文字序列,即不需要使用特徵提取器。