MCPcopy Index your code
hub / github.com/scikit-learn/scikit-learn / transform

Method transform

sklearn/random_projection.py:591–613  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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
616class SparseRandomProjection(BaseRandomProjection):

Callers

nothing calls this directly

Calls 3

check_is_fittedFunction · 0.90
validate_dataFunction · 0.90
_align_api_if_sparseFunction · 0.90

Tested by

no test coverage detected