Skip to content

WIP: OrthogonalMatchingPursuitCV #1042

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

Closed
wants to merge 5 commits into from
Closed
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
9 changes: 7 additions & 2 deletions sklearn/decomposition/fastica_.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@ def __init__(self, n_components=None, algorithm='parallel', whiten=True,
self.tol = tol
self.w_init = w_init
self.random_state = random_state
self.compute_sources = compute_sources

def fit_transform(self, X, y=None):
"""Fit the model and recover the sources from X.
Expand All @@ -413,7 +414,8 @@ def fit_transform(self, X, y=None):
X=X, n_components=self.n_components, algorithm=self.algorithm,
whiten=self.whiten, fun=self.fun, fun_args=fun_args,
max_iter=self.max_iter, tol=self.tol, w_init=self.w_init,
random_state=self.random_state, return_X_mean=True)
random_state=self.random_state, return_X_mean=True,
compute_sources=self.compute_sources)
if self.whiten:
self.components_ = np.dot(unmixing_, whitening_)
self.mean_ = X_mean
Expand All @@ -422,7 +424,10 @@ def fit_transform(self, X, y=None):
self.components_ = unmixing_

self.mixing_ = linalg.pinv(self.components_)
self.sources_ = sources_

if self.compute_sources:
self.sources_ = sources_

return sources_

def fit(self, X, y=None):
Expand Down
4 changes: 3 additions & 1 deletion sklearn/linear_model/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
from .ridge import (Ridge, RidgeCV, RidgeClassifier, RidgeClassifierCV,
ridge_regression)
from .logistic import LogisticRegression
from .omp import orthogonal_mp, orthogonal_mp_gram, OrthogonalMatchingPursuit
from .omp import (orthogonal_mp, orthogonal_mp_gram, OrthogonalMatchingPursuit,
OrthogonalMatchingPursuitCV)
from .passive_aggressive import PassiveAggressiveClassifier
from .passive_aggressive import PassiveAggressiveRegressor
from .perceptron import Perceptron
Expand All @@ -49,6 +50,7 @@
'MultiTaskElasticNet',
'MultiTaskLasso',
'OrthogonalMatchingPursuit',
'OrthogonalMatchingPursuitCV',
'PassiveAggressiveClassifier',
'PassiveAggressiveRegressor',
'Perceptron',
Expand Down
Loading