Table Of Contents

Previous topic

datasets.event

Next topic

datasets.masked

This content refers to the previous stable release of PyMVPA. Please visit www.pymvpa.org for the most recent version of PyMVPA and its documentation.

datasets.mapped

Module: datasets.mapped

Inheritance diagram for mvpa.datasets.mapped:

Mapped dataset

MappedDataset

class mvpa.datasets.mapped.MappedDataset(samples=None, mapper=None, dsattr=None, **kwargs)

Bases: mvpa.datasets.base.Dataset

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).

See also

Please refer to the documentation of the base class for more information:

Dataset

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.
  • data (dict) – Dictionary with an arbitrary number of entries. The value for each key in the dict has to be an ndarray with the same length as the number of rows in the samples array. A special entry in this dictionary is ‘samples’, a 2d array (samples x features). A shallow copy is stored in the object.
  • dsattr (dict) – Dictionary of dataset attributes. An arbitrary number of arbitrarily named and typed objects can be stored here. A shallow copy of the dictionary is stored in the object.
  • dtype (type | None) – If None – do not change data type if samples is an ndarray. Otherwise convert samples to dtype.
O

Return samples in the original shape

mapForward(data)

Map data from the original dataspace into featurespace.

mapReverse(data)

Reverse map data from featurespace into the original dataspace.

mapSelfReverse()

Reverse samples from featurespace into the original dataspace.

mapper
samples_original

Return samples in the original shape

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

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