机器学习算法的特征使用

Feature usage for machine learning algorithm

给定用户安装的软件列表作为功能,例如,

Microsoft_VC80_DebugCRT_x86_x64 1.0.0
Microsoft_VC80_DebugCRT_x86 1.0.0
Windows UPnP Browser 0.1.01
Adobe Acrobat Professional 10

我想预测学生是否会购买某种产品。

现在的问题是:有什么方法可以将软件列表变成机器学习算法可以学习的东西?

最简单的方法是使用来自 scikit learn 的 vectorizer

from sklearn.feature_extraction.text import CountVectorizer

#min_df is the minimum number of students 
#that have to have a piece of software installed to be included in 
#the feature set

vectorizer = CountVectorizer(min_df=1)
X = vectorizer.fit_transform(data)

向量化器将构造一个向量,其中每一列都映射到数据集中的 'terms' 之一(此处为一个软件),该值将是该术语出现的次数特定的学生。每个学生现在将由一个向量表示。这些向量可以作为特征输入到 scikit-learn.

支持的大多数算法中