Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with Preparing the data #33

Open
caiquanyou opened this issue Aug 18, 2020 · 0 comments
Open

Problem with Preparing the data #33

caiquanyou opened this issue Aug 18, 2020 · 0 comments

Comments

@caiquanyou
Copy link

caiquanyou commented Aug 18, 2020

In the 02_Exploratory_analysis_of_single_cell_data_with_SAUCIE.ipynb example, i run it and get some error issues below:
'data = pca_op.fit_transform(data_raw)'
TypeError Traceback (most recent call last)
in
1 pca_op = sklearn.decomposition.PCA(100)
----> 2 data = pca_op.fit_transform(data_raw)
3 data

/usr/local/lib/python3.6/dist-packages/sklearn/decomposition/_pca.py in fit_transform(self, X, y)
374 C-ordered array, use 'np.ascontiguousarray'.
375 """
--> 376 U, S, V = self.fit(X)
377 U = U[:, :self.n_components
]
378

/usr/local/lib/python3.6/dist-packages/sklearn/decomposition/_pca.py in _fit(self, X)
396
397 X = self._validate_data(X, dtype=[np.float64, np.float32],
--> 398 ensure_2d=True, copy=self.copy)
399
400 # Handle n_components==None

/usr/local/lib/python3.6/dist-packages/sklearn/base.py in _validate_data(self, X, y, reset, validate_separately, **check_params)
418 f"requires y to be passed, but the target y is None."
419 )
--> 420 X = check_array(X, **check_params)
421 out = X
422 else:

/usr/local/lib/python3.6/dist-packages/sklearn/utils/validation.py in inner_f(*args, **kwargs)
70 FutureWarning)
71 kwargs.update({k: arg for k, arg in zip(sig.parameters, args)})
---> 72 return f(**kwargs)
73 return inner_f
74

/usr/local/lib/python3.6/dist-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)
576 dtype=dtype, copy=copy,
577 force_all_finite=force_all_finite,
--> 578 accept_large_sparse=accept_large_sparse)
579 else:
580 # If np.array(..) gives ComplexWarning, then we convert the warning

/usr/local/lib/python3.6/dist-packages/sklearn/utils/validation.py in _ensure_sparse_format(spmatrix, accept_sparse, dtype, copy, force_all_finite, accept_large_sparse)
351
352 if accept_sparse is False:
--> 353 raise TypeError('A sparse matrix was passed, but dense '
354 'data is required. Use X.toarray() to '
355 'convert to a dense numpy array.')

TypeError: A sparse matrix was passed, but dense data is required. Use X.toarray() to convert to a dense numpy array.
I wonder how to fix this problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant