Skip to content

[MRG+1] y not needed in transform in Birch #9066

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

Merged
merged 3 commits into from
Jun 8, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sklearn/cluster/birch.py
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ def predict(self, X):
reduced_distance += self._subcluster_norms
return self.subcluster_labels_[np.argmin(reduced_distance, axis=1)]

def transform(self, X, y=None):
def transform(self, X):
"""
Transform X into subcluster centroids dimension.

Expand Down
2 changes: 1 addition & 1 deletion sklearn/cluster/k_means_.py
Original file line number Diff line number Diff line change
Expand Up @@ -913,7 +913,7 @@ def fit_transform(self, X, y=None):
X = self._check_fit_data(X)
return self.fit(X)._transform(X)

def transform(self, X, y=None):
def transform(self, X):
"""Transform X to a cluster-distance space.

In the new space, each dimension is the distance to the cluster
Expand Down
2 changes: 1 addition & 1 deletion sklearn/decomposition/dict_learning.py
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,7 @@ def _set_sparse_coding_params(self, n_components,
self.split_sign = split_sign
self.n_jobs = n_jobs

def transform(self, X, y=None):
def transform(self, X):
"""Encode the data as a sparse combination of the dictionary atoms.

Coding method is determined by the object parameter
Expand Down
2 changes: 1 addition & 1 deletion sklearn/decomposition/pca.py
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@ def _fit(self, X):

return X

def transform(self, X, y=None):
def transform(self, X):
"""Apply dimensionality reduction on X.

X is projected on the first principal components previous extracted
Expand Down
4 changes: 1 addition & 3 deletions sklearn/feature_extraction/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ def fit(self, X, y=None):
self._get_hasher().fit(X, y=y)
return self

def transform(self, X, y=None):
def transform(self, X):
"""Transform a sequence of documents to a document-term matrix.

Parameters
Expand All @@ -469,8 +469,6 @@ def transform(self, X, y=None):
unicode strings, file name or file object depending on the
constructor argument) which will be tokenized and hashed.

y : (ignored)

Returns
-------
X : scipy.sparse matrix, shape = (n_samples, self.n_features)
Expand Down
4 changes: 1 addition & 3 deletions sklearn/random_projection.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,16 +392,14 @@ def fit(self, X, y=None):

return self

def transform(self, X, y=None):
def transform(self, X):
"""Project the data by using matrix product with the random matrix

Parameters
----------
X : numpy array or scipy.sparse of shape [n_samples, n_features]
The input data to project into a smaller dimensional space.

y : is not used: placeholder to allow for usage in a Pipeline.

Returns
-------
X_new : numpy array or scipy sparse of shape [n_samples, n_components]
Expand Down