Skip to content
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

[ENH] PCA on sparse data. #2313

Merged
merged 6 commits into from
May 26, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
Projector: supports_sparse attribute
supports_sparse indicates whether projector can handle sparse data.
  • Loading branch information
acopar committed May 26, 2017
commit 2a0bf38bacd63a968a29ea4a8603dcb832e505ea
2 changes: 2 additions & 0 deletions Orange/projection/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ class SklProjector(Projector, metaclass=WrapperMeta):
__wraps__ = None
_params = {}
name = 'skl projection'
supports_sparse = False
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be moved to Projector?


preprocessors = [Orange.preprocess.Continuize(),
Orange.preprocess.SklImpute()]

Expand Down
3 changes: 3 additions & 0 deletions Orange/projection/pca.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def score(self, data):
class PCA(SklProjector, _FeatureScorerMixin):
__wraps__ = skl_decomposition.PCA
name = 'pca'
supports_sparse = False

def __init__(self, n_components=None, copy=True, whiten=False,
svd_solver='auto', tol=0.0, iterated_power='auto',
Expand Down Expand Up @@ -61,6 +62,7 @@ def fit(self, X, Y=None):
class SparsePCA(SklProjector):
__wraps__ = skl_decomposition.SparsePCA
name = 'sparse pca'
supports_sparse = False

def __init__(self, n_components=None, alpha=1, ridge_alpha=0.01,
max_iter=1000, tol=1e-8, method='lars', n_jobs=1, U_init=None,
Expand Down Expand Up @@ -125,6 +127,7 @@ def pca_variable(i):
class IncrementalPCA(SklProjector):
__wraps__ = skl_decomposition.IncrementalPCA
name = 'incremental pca'
supports_sparse = False

def __init__(self, n_components=None, whiten=False, copy=True,
batch_size=None, preprocessors=None):
Expand Down