我正在尝试规范化我的数据。目前我获取数据的方法只是计算一些序列。我想在这些数据上运行SVM,但我在scikit-learn文档中建议将数据扩展到区间[-1,1]或[0,1]。他们建议使用MinMaxScaler。我试图使用它,但它只是不起作用。我收到了这个错误:
C:\Python27\lib\site-packages\sklearn\utils\validation.py:332:
UserWarning: MinMaxScaler assumes floating point values as input, got |S27
"got %s" % (estimator, X.dtype))
Traceback (most recent call last):
File "C:/Users/Matej/PycharmProjects/Diploma/get_viral_sequence.py", line 455, in <module>
min_max_scaler.fit_transform(np.asarray(matrix[1:, :len(sequence_attributes)]))
File "C:\Python27\lib\site-packages\sklearn\base.py", line 426, in fit_transform
return self.fit(X, **fit_params).transform(X)
File "C:\Python27\lib\site-packages\sklearn\preprocessing\data.py", line 204, in fit
data_min = np.min(X, axis=0)
File "C:\Python27\lib\site-packages\numpy\core\fromnumeric.py", line 2214, in amin
out=out, keepdims=keepdims)
File "C:\Python27\lib\site-packages\numpy\core\_methods.py", line 21, in _amin
out=out, keepdims=keepdims)
TypeError: cannot perform reduce with flexible type
我试图保存数据而不进行转换(list_temp.count(attr)),将其转换为numpy.int32并将其转换为numpy.float32,它始终是相同的结果。
数组的形状为(44, 16384)
。