Skip to content

Commit 6e04e28

Browse files
authored
Merge pull request #2563 from jerneju/freeviz-script
[ENH] FreeViz script
2 parents 9b61bef + 3769d62 commit 6e04e28

File tree

6 files changed

+615
-18
lines changed

6 files changed

+615
-18
lines changed

Orange/projection/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
from .pca import *
33
from .cur import *
44
from .manifold import *
5+
from .freeviz import *

Orange/projection/base.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,21 @@
66
from Orange.misc.wrapper_meta import WrapperMeta
77
import Orange.preprocess
88

9-
__all__ = ["Projector", "Projection", "SklProjector"]
9+
__all__ = ["LinearCombinationSql", "Projector", "Projection", "SklProjector"]
10+
11+
12+
class LinearCombinationSql:
13+
def __init__(self, attrs, weights, mean=None):
14+
self.attrs = attrs
15+
self.weights = weights
16+
self.mean = mean
17+
18+
def __call__(self):
19+
if self.mean is None:
20+
return ' + '.join('{} * {}'.format(w, a.to_sql())
21+
for a, w in zip(self.attrs, self.weights))
22+
return ' + '.join('{} * ({} - {})'.format(w, a.to_sql(), m, w)
23+
for a, m, w in zip(self.attrs, self.mean, self.weights))
1024

1125

1226
class Projector(_ReprableWithPreprocessors):

0 commit comments

Comments
 (0)