If there's no samples, returns an empty liss
Merge request reports
Activity
These classes are supposed to follow scikit-learn's API, aren't they?
pca.transform([]) --------------------------------------------------------------------------- ValueError Traceback (most recent call last) <ipython-input-13-30a799240129> in <module> ----> 1 pca.transform([]) ~/miniconda/envs/bob36/lib/python3.6/site-packages/sklearn/decomposition/_base.py in transform(self, X) 125 check_is_fitted(self) 126 --> 127 X = check_array(X) 128 if self.mean_ is not None: 129 X = X - self.mean_ ~/miniconda/envs/bob36/lib/python3.6/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, warn_on_dtype, estimator) 554 "Reshape your data either using array.reshape(-1, 1) if " 555 "your data has a single feature or array.reshape(1, -1) " --> 556 "if it contains a single sample.".format(array)) 557 558 # in the future np.flexible dtypes will be handled like object dtypes ValueError: Expected 2D array, got 1D array instead: array=[]. 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. pca.transform([[]]) --------------------------------------------------------------------------- ValueError Traceback (most recent call last) <ipython-input-14-6a037ad0a10e> in <module> ----> 1 pca.transform([[]]) ~/miniconda/envs/bob36/lib/python3.6/site-packages/sklearn/decomposition/_base.py in transform(self, X) 125 check_is_fitted(self) 126 --> 127 X = check_array(X) 128 if self.mean_ is not None: 129 X = X - self.mean_ ~/miniconda/envs/bob36/lib/python3.6/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, warn_on_dtype, estimator) 592 " a minimum of %d is required%s." 593 % (n_features, array.shape, ensure_min_features, --> 594 context)) 595 596 if warn_on_dtype and dtype_orig is not None and array.dtype != dtype_orig: ValueError: Found array with 0 feature(s) (shape=(1, 0)) while a minimum of 1 is required.
Please register or sign in to reply