Package mvpa :: Package mappers :: Module base :: Class ChainMapper

[hide private]
[frames] | no frames]

# Class ChainMapper

source code

Meta mapper that embedded a chain of other mappers.

Each mapper in the chain is called successively to perform forward or reverse mapping.

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

Instance Methods | [hide private]

__init__(self, mappers, **kwargs) :Parameters: mappers: list of Mapper instances **kwargs All additional arguments are passed to the base-class constructor. | source code

forward(self, data) Calls all mappers in the chain successively. | source code

reverse(self, data) Calls all mappers in the chain successively, in reversed order. | source code

train(self, dataset) Trains the *last* mapper in the chain. | 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 from the last mapper in the chain. | 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
      **kwargs
        All additional arguments are passed to the base-class constructor.

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

### forward(self, data)

source code

Calls all mappers in the chain successively.

Overrides: Mapper.forward

### reverse(self, data)

source code

Calls all mappers in the chain successively, in reversed order.

Overrides: Mapper.reverse

### train(self, dataset)

source code

    Trains the *last* mapper in the chain.

    :Parameter:
      dataset: :class:`~mvpa.datasets.base.Dataset` or subclass
        A dataset with the number of features matching the `outSize` of the
        last mapper in the chain (which is identical to the one of the
        `ChainMapper` itself).

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 from the last mapper in the chain.

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.

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!

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)