比例数据错误:“ ValueError:设置具有序列的数组元素。”

时间:2018-08-09 18:17:00

标签: python tensorflow scikit-learn

我正在用嘴唇格式的数据运行测试,其中列“ a”是我的top_lip,列“ b”是我的bottom_lip,它们都是12个元组的数组(我已经对此进行了验证)。

Image

from sklearn.preprocessing import StandardScaler 
scaler = StandardScaler()
# Fit only to the training data
scaler.fit(X_train)

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-59-e7a81294879e> in <module>()
      2 scaler = StandardScaler()
      3 # Fit only to the training data
----> 4 scaler.fit(X_train)

~/anaconda3/lib/python3.6/site-packages/sklearn/preprocessing/data.py in fit(self, X, y)
    588         # Reset internal state before fitting
    589         self._reset()
--> 590         return self.partial_fit(X, y)
    591 
    592     def partial_fit(self, X, y=None):

~/anaconda3/lib/python3.6/site-packages/sklearn/preprocessing/data.py in partial_fit(self, X, y)
    610         """
    611         X = check_array(X, accept_sparse=('csr', 'csc'), copy=self.copy,
--> 612                         warn_on_dtype=True, estimator=self, dtype=FLOAT_DTYPES)
    613 
    614         # Even in the case of `with_mean=False`, we update the mean anyway

~/anaconda3/lib/python3.6/site-packages/sklearn/utils/validation.py in check_array(array, accept_sparse, dtype, order, copy, force_all_finite, ensure_2d, allow_nd, ensure_min_samples, ensure_min_features, warn_on_dtype, estimator)
    431                                       force_all_finite)
    432     else:
--> 433         array = np.array(array, dtype=dtype, order=order, copy=copy)
    434 
    435         if ensure_2d:

ValueError: setting an array element with a sequence.

0 个答案:

没有答案