1

I'm running a test with data from formats of lips where column 'a' is my top_lip and my column 'b' is my bottom_lip, both of them are arrays of 12 tuples (I already verified this).

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.
sP_
  • 1,738
  • 2
  • 15
  • 29
  • Validate the situation given here https://stackoverflow.com/questions/25485503/valueerror-setting-an-array-element-with-a-sequence-while-using-svm-in-scikit – Upasana Mittal Aug 09 '18 at 18:56
  • So I should transform it in a list of numbers like [1,2,3,4]? I tought it should recieve a list of tuples because that's what the sklearn returned to me. everything has the same size and I'm not sure if it would work the same way if I don't send them in pairs. – Igor Antunes Aug 09 '18 at 20:17

0 Answers0