![]() |
Multivariate Pattern Analysis in Python |
Data mapper
The comprehensive API documentation for this module, including all technical details, is available in the Epydoc-generated API reference for mvpa.mappers.base (for developers).
Bases: mvpa.mappers.base.Mapper
Meta mapper that embedded a chain of other mappers.
Each mapper in the chain is called successively to perform forward or reverse mapping.
Note
In its current implementation the ChainMapper treats all but the last mapper as simple pre-processing (in forward()) or post-processing (in reverse()) steps. All other capabilities, e.g. training and neighbor metrics are provided by or affect only the last mapper in the chain.
With respect to neighbor metrics this means that they are determined based on the input space of the last mapper in the chain and not on the input dataspace of the ChainMapper as a whole
Parameters: |
|
---|
Calls all mappers in the chain successively.
Parameters: |
|
---|
Get the ids of the neighbors of a single feature in output dataspace.
Note
The neighbors are determined based on the input space of the last mapper in the chain and not on the input dataspace of the ChainMapper as a whole!
Parameters: |
|
---|
Returns a list of outIds
Calls all mappers in the chain successively, in reversed order.
Parameters: |
|
---|
Remove some elements from the last mapper in the chain.
Parameters: |
|
---|
See also
Derived classes might provide additional methods via their base classes. Please refer to the list of base classes (if it exists) at the begining of the ChainMapper documentation.
Full API documentation of ChainMapper in module mvpa.mappers.base.
Bases: mvpa.mappers.base.Mapper
Meta mapper that combines several embedded mappers.
This mapper can be used the map from several input dataspaces into a common output dataspace. When forward() is called with a sequence of data, each element in that sequence is passed to the corresponding mapper, which in turned forward-maps the data. The output of all mappers is finally stacked (horizontally or column or feature-wise) into a single large 2D matrix (nsamples x nfeatures).
Note
This mapper can only embbed mappers that transform data into a 2D (nsamples x nfeatures) representation. For mappers not supporting this transformation, consider wrapping them in a ChainMapper with an appropriate post-processing mapper.
CombinedMapper fully supports forward and backward mapping, training, runtime selection of a feature subset (in output dataspace) and retrieval of neighborhood information.
Parameters: |
|
---|
Map data from the IN spaces into to common OUT space.
Parameters: |
|
---|---|
Return type: | array |
Returns: | Horizontally stacked array of all embedded mapper outputs. |
Get the ids of the neighbors of a single feature in output dataspace.
Parameters: |
|
---|
Returns a list of outIds
Reverse map data from OUT space into the IN spaces.
Parameters: |
|
---|---|
Return type: | list |
Remove some elements and leave only ids in ‘out’/feature space.
Note
The subset selection is done inplace
Parameters: |
|
---|
Trains all embedded mappers.
The provided training dataset is splitted appropriately and the corresponding pieces are passed to the train() method of each embedded mapper.
Parameters: |
|
---|
See also
Derived classes might provide additional methods via their base classes. Please refer to the list of base classes (if it exists) at the begining of the CombinedMapper documentation.
Full API documentation of CombinedMapper in module mvpa.mappers.base.
Bases: object
Interface to provide mapping between two spaces: IN and OUT. Methods are prefixed correspondingly. forward/reverse operate on the entire dataset. get(In|Out)Id[s] operate per element:
forward
--------->
IN OUT
<--------/
reverse
Parameters: |
|
---|
Translate a feature id into a coordinate/index in input space.
Such a translation might not be meaningful or even possible for a particular mapping algorithm and therefore cannot be relied upon.
Get feature neighbors in input space, given an id in output space.
This method has to be reimplemented whenever a derived class does not provide an implementation for getInId().
Return the list of coordinates for the neighbors.
Parameters: |
|
---|
XXX See TODO below: what to return – list of arrays or list of tuples?
Return the list of coordinates for the neighbors.
By default it simply constructs the list based on the generator returned by getNeighbor()
Validate id in IN space.
Override if IN space is not simly a 1D vector
Validate feature id in OUT space.
Override if OUT space is not simly a 1D vector
str(object) -> string
Return a nice string representation of the object. If the argument is a string, the return value is the same object.
Limit the OUT space to a certain set of features.
Parameters: |
|
---|
Perform training of the mapper.
This method is called to put the mapper in a state that allows it to perform to intended mapping.
Parameters: |
|
---|
Note
The default behavior of this method is to do nothing.
See also
Derived classes might provide additional methods via their base classes. Please refer to the list of base classes (if it exists) at the begining of the Mapper documentation.
Full API documentation of Mapper in module mvpa.mappers.base.
Bases: mvpa.mappers.base.Mapper
Mapper using a projection matrix to transform the data.
This class cannot be used directly. Sub-classes have to implement the _train() method, which has to compute the projection matrix given a dataset (see _train() docstring for more information).
Once the projection matrix is available, this class provides functionality to perform forward and backwards mapping of data, the latter using the hermitian (conjugate) transpose of the projection matrix. Additionally, ProjectionMapper supports optional (but done by default) demeaning of the data and selection of arbitrary component (i.e. columns of the projection matrix) of the projection.
Forward and back-projection matrices (a.k.a. projection and reconstruction) are available via the proj and recon properties. the latter only after it has been computed (after first call to reverse).
Initialize the ProjectionMapper
Parameters: |
|
---|
Perform forward projection.
Parameters: |
|
---|---|
Return type: | NumPy array |
Reproject (reconstruct) data into the original feature space.
Return type: | NumPy array |
---|
See also
Derived classes might provide additional methods via their base classes. Please refer to the list of base classes (if it exists) at the begining of the ProjectionMapper documentation.
Full API documentation of ProjectionMapper in module mvpa.mappers.base.