我的功能值为freezeset,这会导致scikit的训练功能失败:
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 be a string or a number
v是一个冷冻集:
v=frozenset([u'HY', u'N'])
那么如何训练使用freezeset或者我应该将冷冻集转换成哈希值,从而失去了解特征值的可能性?或将其转换为已排序的元组? 这可能与this question
有关此外,我希望分类器学习freezeset([u'HY',u'N'])类似于frozenset([u'HY'])如果我存储哈希我可能无法实现这一点因为两个哈希都不可比(我的假设)。