As a beginner in programming, I have some problems with the categorization of text via a machine learning experiment with Scikit learn. I use 10-fold cross validation so there is no division in train and test data.
My problem starts in the feature extraction module. This is the code with the error:
vec = DictVectorizer()
X = vec.fit_transform(instances).toarray()
The last line gives the following error:
TypeError: float() argument must be a string or a number, not 'dict'
Instances is a list of feature vector dictionaries,with a dictionary per document. An example of the beginning of the instances list (you can see a part of the dictionary for the first document).
Some features are a dictionary nested in the feature vector dictionary. I don't know how to make it unnested, but maybe this is the problem?