Package mvpa :: Package mappers :: Module base :: Class CombinedMapper

[hide private]
[frames] | no frames]

# Class CombinedMapper

source code

    Meta mapper that combines several embedded mappers.

    This mapper can be used the map from several input dataspaces into a common
    output dataspace. When :meth:`~mvpa.mappers.base.CombinedMapper.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
      :class:`~mvpa.mappers.base.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.

Instance Methods | [hide private]

__init__(self, mappers, **kwargs) :Parameters: mappers: list of Mapper instances The order of the mappers in the list is important, as it will define the order in which data snippets have to be passed to :meth:`~mvpa.mappers.base.CombinedMapper.forward`. | source code

forward(self, data) Map data from the IN spaces into to common OUT space. | source code

reverse(self, data) Reverse map data from OUT space into the IN spaces. | source code

train(self, dataset) Trains all embedded mappers. | source code

getInSize(self) Returns the size of the entity in input space | source code

getOutSize(self) Returns the size of the entity in output space | source code

selectOut(self, outIds) Remove some elements and leave only ids in 'out'/feature space. | source code

getNeighbor(self, outId, *args, **kwargs) Get the ids of the neighbors of a single feature in output dataspace. | source code

__repr__(self) repr(x) | source code

Inherited from `Mapper`: `__call__`, `getInId`, `getMetric`, `getNeighborIn`, `getNeighbors`, `isValidInId`, `isValidOutId`, `setMetric` Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__setattr__`, `__sizeof__`, `__str__`, `__subclasshook__`

Class Variables | [hide private]

Inherited from `Mapper`: `metric`, `nfeatures`

Properties | [hide private]

Inherited from `object`: `__class__`

Method Details | [hide private]

### __init__(self, mappers, **kwargs)
(Constructor)

source code

    :Parameters:
      mappers: list of Mapper instances
        The order of the mappers in the list is important, as it will define
        the order in which data snippets have to be passed to
        :meth:`~mvpa.mappers.base.CombinedMapper.forward`.
      **kwargs
        All additional arguments are passed to the base-class constructor.

Parameters:
  - `metric` - Optional metric
Overrides: object.__init__

### forward(self, data)

source code

Map data from the IN spaces into to common OUT space.

Returns:
  array: nsamples x nfeatures
    Horizontally stacked array of all embedded mapper outputs.
Overrides: Mapper.forward

### reverse(self, data)

source code

Reverse map data from OUT space into the IN spaces.

Returns:
  list
Overrides: Mapper.reverse

### train(self, dataset)

source code

    Trains all embedded mappers.

    The provided training dataset is splitted appropriately and the
    corresponding pieces are passed to the
    :meth:`~mvpa.mappers.base.Mapper.train` method of each embedded mapper.

    :Parameter:
      dataset: :class:`~mvpa.datasets.base.Dataset` or subclass
        A dataset with the number of features matching the `outSize` of the
        `CombinedMapper`.

Overrides: Mapper.train

### getInSize(self)

source code

Returns the size of the entity in input space

Overrides: Mapper.getInSize

### getOutSize(self)

source code

Returns the size of the entity in output space

Overrides: Mapper.getOutSize

### selectOut(self, outIds)

source code

Remove some elements and leave only ids in 'out'/feature space.

The subset selection is done inplace

Parameters:
  - `outIds`, `sequence` - Subset of ids of the current feature in OUT space to keep.
Overrides: Mapper.selectOut

### getNeighbor(self, outId, *args, **kwargs)

source code

Get the ids of the neighbors of a single feature in output dataspace.

Returns a list of outIds

Overrides: Mapper.getNeighbor

Parameters:

outId: int
  Single id of a feature in output space, whos neighbors should be determined.
*args, **kwargs
  Additional arguments are passed to the metric of the embedded mapper, that is responsible for the corresponding feature.

### __repr__(self)
(Representation operator)

source code

repr(x)

Overrides: object.__repr__
  (inherited documentation)