April 2017
Beginner to intermediate
358 pages
9h 30m
English
The next step converts the dictionaries built as per the previous step into a matrix that can be used with a classifier. This step is made quite simple through the DictVectorizer transformer that is provided as part of scikit-learn.
The DictVectorizer class simply takes a list of dictionaries and converts them into a matrix. The features in this matrix are the keys in each of the dictionaries, and the values correspond to the occurrence of those features in each sample. Dictionaries are easy to create in code, but many data algorithm implementations prefer matrices. This makes DictVectorizer a very useful class.
In our dataset, each dictionary has words as keys and only occurs if the word actually occurs ...
Read now
Unlock full access