Scikit-learn 的 DictVectorizer 怎麼使用
2015-08-02
以往使用的機器學習(Machine Learning)工具都是 LIBSVM,而這次因緣際會用了 Python 的 scikit-learn,卻不知道如何使用自己的 Feature,剛好來記錄一下。
scikit-learn 很強大的內建了幾種 Feature generator,像是 CountVectorizer、TfidfVectorizer…等等。而 DictVectorizer 則可以搭配自己的 Feature ,用法如下:
1 | from sklearn.feature_extraction import DictVectorizer |