Project the data by using matrix product with the random matrix. Parameters ---------- X : {ndarray, sparse matrix} of shape (n_samples, n_features) The input data to project into a smaller dimensional space. Returns ------- X_new : ndarr
(self, X)
| 589 | ) |
| 590 | |
| 591 | def transform(self, X): |
| 592 | """Project the data by using matrix product with the random matrix. |
| 593 | |
| 594 | Parameters |
| 595 | ---------- |
| 596 | X : {ndarray, sparse matrix} of shape (n_samples, n_features) |
| 597 | The input data to project into a smaller dimensional space. |
| 598 | |
| 599 | Returns |
| 600 | ------- |
| 601 | X_new : ndarray of shape (n_samples, n_components) |
| 602 | Projected array. |
| 603 | """ |
| 604 | check_is_fitted(self) |
| 605 | X = validate_data( |
| 606 | self, |
| 607 | X, |
| 608 | accept_sparse=["csr", "csc"], |
| 609 | reset=False, |
| 610 | dtype=[np.float64, np.float32], |
| 611 | ) |
| 612 | |
| 613 | return _align_api_if_sparse(X @ self.components_.T) |
| 614 | |
| 615 | |
| 616 | class SparseRandomProjection(BaseRandomProjection): |
nothing calls this directly
no test coverage detected