Skip to content
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
1 change: 1 addition & 0 deletions Orange/projection/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
from .pca import *
from .cur import *
from .manifold import *
from .freeviz import *
16 changes: 15 additions & 1 deletion Orange/projection/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,21 @@
from Orange.misc.wrapper_meta import WrapperMeta
import Orange.preprocess

__all__ = ["Projector", "Projection", "SklProjector"]
__all__ = ["LinearCombinationSql", "Projector", "Projection", "SklProjector"]


class LinearCombinationSql:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't know what this actually does, but I suppose that this is a general linear combination, and it also supports SQL -- and not a linear combination that requires SQL, right? If so, the name is misleading. @lanzagar, could you help here?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is the sql equivalent of the compute_value. It only works for sql, as in-memory data is processed with a different object - Projector.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ah, OK, I see. Thanks.

def __init__(self, attrs, weights, mean=None):
self.attrs = attrs
self.weights = weights
self.mean = mean

def __call__(self):
if self.mean is None:
return ' + '.join('{} * {}'.format(w, a.to_sql())
for a, w in zip(self.attrs, self.weights))
return ' + '.join('{} * ({} - {})'.format(w, a.to_sql(), m, w)
for a, m, w in zip(self.attrs, self.mean, self.weights))


class Projector(_ReprableWithPreprocessors):
Expand Down
Loading