Package mvpa :: Package mappers :: Module base :: Class Mapper

[hide private]
[frames] | no frames]

# Class Mapper

source code

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

Instance Methods | [hide private]

__init__(self, metric=None) x.__init__(...) initializes x; see help(type(x)) for signature | source code

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

reverse(self, data) Reverse map data from OUT space into the IN space. | 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) Limit the OUT space to a certain set of features. | source code

getInId(self, outId) Translate a feature id into a coordinate/index in input space. | source code

isValidOutId(self, outId) Validate feature id in OUT space. | source code

isValidInId(self, inId) Validate id in IN space. | source code

train(self, dataset) Perform training of the mapper. | source code

getNeighbor(self, outId, *args, **kwargs) Get feature neighbors in input space, given an id in output space. | source code

getNeighborIn(self, inId, *args, **kwargs) Return the list of coordinates for the neighbors. | source code

getNeighbors(self, outId, *args, **kwargs) Return the list of coordinates for the neighbors. | source code

__repr__(self) repr(x) | source code

__call__(self, data) Calls the mappers forward() method. | source code

getMetric(self) To make pylint happy | source code

setMetric(self, metric) To make pylint happy | source code

Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__setattr__`, `__sizeof__`, `__str__`, `__subclasshook__`

Class Variables | [hide private]

| metric = `property(fget= getMetric, fset= setMetric)`
| nfeatures = `VProperty(fget= getOutSize)`

Instance Variables | [hide private]

| __metric Pylint happiness

Properties | [hide private]

Inherited from `object`: `__class__`

Method Details | [hide private]

### __init__(self, metric=None)
(Constructor)

source code

x.__init__(...) initializes x; see help(type(x)) for signature

Parameters:
  - `metric` (Metric) - Optional metric
Overrides: object.__init__

### selectOut(self, outIds)

source code

Limit the OUT space to a certain set of features.

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

### getInId(self, outId)

source code

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.

### isValidOutId(self, outId)

source code

Validate feature id in OUT space.

Override if OUT space is not simly a 1D vector

### isValidInId(self, inId)

source code

Validate id in IN space.

Override if IN space is not simly a 1D vector

### train(self, dataset)

source code

Perform training of the mapper.

This method is called to put the mapper in a state that allows it to perform to intended mapping.

The default behavior of this method is to do nothing.

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

source code

    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 :meth:`~mvpa.mappers.base.Mapper.getInId`.

### getNeighborIn(self, inId, *args, **kwargs)

source code

Return the list of coordinates for the neighbors.

XXX See TODO below: what to return -- list of arrays or list of tuples?

Parameters:

inId
  id (index) of an element in input dataspace.
*args, **kwargs
  Any additional arguments are passed to the embedded metric of the mapper.

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

source code

Return the list of coordinates for the neighbors.

By default it simply constructs the list based on the generator returned by getNeighbor()

### __repr__(self)
(Representation operator)

source code

repr(x)

Overrides: object.__repr__
  (inherited documentation)