1
2
3
4
5
6
7
8
9 """Hyperalignment of functional data to the common space
10
11 References: TODO...
12
13 see SMLR code for example on how to embed the reference so in future
14 it gets properly referenced...
15 """
16
17 __docformat__ = 'restructuredtext'
18
19 from mvpa.support.copy import deepcopy
20
21 from mvpa.base import warning
22 from mvpa.misc.state import StateVariable, ClassWithCollections
23 from mvpa.misc.param import Parameter
24 from mvpa.misc.transformers import GrandMean
25
26 if __debug__:
27 from mvpa.base import debug
28
29
31 """ ...
32
33 Given a set of datasets (may be just data) provide mapping of
34 features into a common space
35 """
36
37
38 who_knows_maybe_something_to_store_optionally = \
39 StateVariable(enabled=False, doc= """....""")
40
41
42
43 alignment = Parameter(None,
44 doc="""... XXX If `None` (default) an instance of
45 :class:`~mvpa.mappers.procrustean.ProcrusteanMapper` is
46 used.""")
47
48 levels = Parameter(3, allowedtype='int', min=1,
49 doc="Number of levels ....XXX ")
50
51 combiner1 = Parameter('mean',
52 doc="XXX ")
53
54 combiner2 = Parameter('mean',
55 doc="XXX ")
56
57
58 - def __init__(self,
59 alignment=None,
60 levels=3,
61 combiner1='mean',
62 combiner2='mean',
63 **kwargs):
71
72
74 """Estimate mappers for each data(set)
75
76 Parameters
77 ----------
78 data : list or tuple of dataset of data
79 XXX
80
81 Returns
82 -------
83 A list of trained Mappers ... of length equal to len(data)
84 """
85 params = self.params
86 nelements = len(data)
87
88
89 result = [deepcopy(params.alignment) for i in xrange(nelements)]
90
91
92 commonspace = data[0]
93 for m, d in zip(mappers[1:], data[1:]):
94
95 m.train(d, commonspace)
96 commonspace = mean(m.forward(d), commonspace)
97
98
99
100
101
102 return result
103