Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ValueError Traceback (most recent call last)
- ~\AppData\Local\Temp/ipykernel_11092/4166757493.py in <module>
- 1 from sklearn import preprocessing
- 2
- ----> 3 scaler = preprocessing.StandardScaler().fit(SXtrain)
- 4
- 5 """Scale the smaller training set"""
- ~\anaconda3\lib\site-packages\sklearn\preprocessing\_data.py in fit(self, X, y, sample_weight)
- 728 # Reset internal state before fitting
- 729 self._reset()
- --> 730 return self.partial_fit(X, y, sample_weight)
- 731
- 732 def partial_fit(self, X, y=None, sample_weight=None):
- ~\anaconda3\lib\site-packages\sklearn\preprocessing\_data.py in partial_fit(self, X, y, sample_weight)
- 764 """
- 765 first_call = not hasattr(self, "n_samples_seen_")
- --> 766 X = self._validate_data(X, accept_sparse=('csr', 'csc'),
- 767 estimator=self, dtype=FLOAT_DTYPES,
- 768 force_all_finite='allow-nan', reset=first_call)
- ~\anaconda3\lib\site-packages\sklearn\base.py in _validate_data(self, X, y, reset, validate_separately, **check_params)
- 419 out = X
- 420 elif isinstance(y, str) and y == 'no_validation':
- --> 421 X = check_array(X, **check_params)
- 422 out = X
- 423 else:
- ~\anaconda3\lib\site-packages\sklearn\utils\validation.py in inner_f(*args, **kwargs)
- 61 extra_args = len(args) - len(all_args)
- 62 if extra_args <= 0:
- ---> 63 return f(*args, **kwargs)
- 64
- 65 # extra_args > 0
- ~\anaconda3\lib\site-packages\sklearn\utils\validation.py in check_array(array, accept_sparse, accept_large_sparse, dtype, order, copy, force_all_finite, ensure_2d, allow_nd, ensure_min_samples, ensure_min_features, estimator)
- 692 # If input is 1D raise error
- 693 if array.ndim == 1:
- --> 694 raise ValueError(
- 695 "Expected 2D array, got 1D array instead:\narray={}.\n"
- 696 "Reshape your data either using array.reshape(-1, 1) if "
- ValueError: Expected 2D array, got 1D array instead:
- array=[8.21304911e-01 1.44999358e-37 8.76388929e-01].
- Reshape your data either using array.reshape(-1, 1) if your data has a single feature or array.reshape(1, -1) if it contains a single sample.
Advertisement
Add Comment
Please, Sign In to add comment