MCPcopy
hub / github.com/scikit-learn/scikit-learn / transform

Method transform

sklearn/random_projection.py:802–827  ·  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 : {ndar

(self, X)

Source from the content-addressed store, hash-verified

800 )
801
802 def transform(self, X):
803 """Project the data by using matrix product with the random matrix.
804
805 Parameters
806 ----------
807 X : {ndarray, sparse matrix} of shape (n_samples, n_features)
808 The input data to project into a smaller dimensional space.
809
810 Returns
811 -------
812 X_new : {ndarray, sparse matrix} of shape (n_samples, n_components)
813 Projected array. It is a sparse matrix only when the input is sparse and
814 `dense_output = False`.
815 """
816 check_is_fitted(self)
817 X = validate_data(
818 self,
819 X,
820 accept_sparse=["csr", "csc"],
821 reset=False,
822 dtype=[np.float64, np.float32],
823 )
824
825 return _align_api_if_sparse(
826 safe_sparse_dot(X, self.components_.T, dense_output=self.dense_output)
827 )

Callers

nothing calls this directly

Calls 4

check_is_fittedFunction · 0.90
validate_dataFunction · 0.90
_align_api_if_sparseFunction · 0.90
safe_sparse_dotFunction · 0.90

Tested by

no test coverage detected