-
-
Notifications
You must be signed in to change notification settings - Fork 25k
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
FIX SparseCoder set_params works correctly #15236
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1018,12 +1018,18 @@ def __init__(self, dictionary, transform_algorithm='omp', | |
transform_n_nonzero_coefs=None, transform_alpha=None, | ||
split_sign=False, n_jobs=None, positive_code=False, | ||
transform_max_iter=1000): | ||
self._set_sparse_coding_params(dictionary.shape[0], | ||
transform_algorithm, | ||
transform_n_nonzero_coefs, | ||
transform_alpha, split_sign, n_jobs, | ||
positive_code, transform_max_iter) | ||
self.components_ = dictionary | ||
self.dictionary = dictionary | ||
self.transform_algorithm = transform_algorithm | ||
self.transform_n_nonzero_coefs = transform_n_nonzero_coefs | ||
self.transform_alpha = transform_alpha | ||
self.transform_max_iter = transform_max_iter | ||
self.split_sign = split_sign | ||
self.n_jobs = n_jobs | ||
self.positive_code = positive_code | ||
|
||
@property | ||
def n_components(self): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why do we need this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
return self.dictionary.shape[0] | ||
|
||
def fit(self, X, y=None): | ||
"""Do nothing and return the estimator unchanged | ||
|
@@ -1042,6 +1048,7 @@ def fit(self, X, y=None): | |
self : object | ||
Returns the object itself | ||
""" | ||
self.components_ = self.dictionary | ||
return self | ||
|
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this helper method still used?