python - Using comparable frozensets as feature values in machine learning -


i have features values frozenset , causes training function of scikit fail:

traceback (most recent call last):   file "/home//pycharmprojects/assortclassifier.py", line 237, in _train     model = self.train(featureset, classes=labels, partial=partial)   file "/home//pycharmprojects/assorted/tclassifier.py", line 94, in train     x = self._vectorizer.fit_transform(x)   file "/home//anaconda/lib/python2.7/site-packages/sklearn/feature_extraction/dict_vectorizer.py", line 224, in fit_transform     return self._transform(x, fitting=true)   file "/home//anaconda/lib/python2.7/site-packages/sklearn/feature_extraction/dict_vectorizer.py", line 172, in _transform     values.append(dtype(v)) typeerror: float() argument must string or number 

v frozenset:

v=frozenset([u'hy', u'n']) 

so how train using frozenset or should convert frozenset hash , hence losing possibility of knowing feature value? or convert sorted tuple? may related this question

also want classifier learn frozenset([u'hy', u'n']) similar frozenset([u'hy']) if store hash may not able achieve both hashes wont comparable(my assumption).


Comments