Package mvpa :: Package datasets :: Module mapped :: Class MappedDataset
[hide private]
[frames] | no frames]

Class MappedDataset

source code


A Dataset which is created by applying a Mapper to the data.

Upon contruction MappedDataset uses a Mapper to transform the samples from their original into the two-dimensional matrix representation that is required by the Dataset class.

This class enhanced the Dataset interface with two additional methods: mapForward() and mapReverse(). Both take arbitrary data arrays (with matching shape) and transform them using the embedded mapper from the original dataspace into a one- or two-dimensional representation (for arrays corresponding to the shape of a single or multiple samples respectively) or vice versa.

Most likely, this class will not be used directly, but rather indirectly through one of its subclasses (e.g. MaskedDataset).

Instance Methods [hide private]
 
__init__(self, samples=None, mapper=None, dsattr=None, **kwargs)
If samples and mapper arguments are not None the mapper is used to forward-map the samples array and the result is passed to the Dataset constructor.
source code
 
mapForward(self, data)
Map data from the original dataspace into featurespace.
source code
 
mapReverse(self, data)
Reverse map data from featurespace into the original dataspace.
source code
 
mapSelfReverse(self)
Reverse samples from featurespace into the original dataspace.
source code
 
selectFeatures(self, ids, plain=False, sort=False)
Select features given their ids.
source code
Class Variables [hide private]
  __doc__ = enhancedDocString('MappedDataset', locals(), Dataset)
  mapper = property(fget= lambda self: self._dsattr ['mapper'])
  samples_original = property(fget= mapSelfReverse, doc= "Return...
  O = property(fget= mapSelfReverse, doc= "Return samples in the...
Method Details [hide private]

__init__(self, samples=None, mapper=None, dsattr=None, **kwargs)
(Constructor)

source code 
If samples and mapper arguments are not None the mapper is used to forward-map the samples array and the result is passed to the Dataset constructor.

Parameters:

mapper: Instance of Mapper
This mapper will be embedded in the dataset and is used and updated, by all subsequent mapping or feature selection procedures.
**kwargs:
All other arguments are simply passed to and handled by the constructor of Dataset.

selectFeatures(self, ids, plain=False, sort=False)

source code 

Select features given their ids.

The methods behaves similar to Dataset.selectFeatures(), but additionally takes care of adjusting the embedded mapper appropriately.

Parameters:
  • ids, sequence - Iterable container to select ids
  • plain, boolean - Flag whether to return MappedDataset (or just Dataset)
  • sort, boolean - Flag whether to sort Ids. Order matters and selectFeatures assumes incremental order. If not such, in non-optimized code selectFeatures would verify the order and sort

Class Variable Details [hide private]

samples_original

Value:
property(fget= mapSelfReverse, doc= "Return samples in the original sh\
ape")

O

Value:
property(fget= mapSelfReverse, doc= "Return samples in the original sh\
ape")