Package mvpa :: Package datasets :: Module miscfx
[hide private]
[frames] | no frames]

Module miscfx

source code

Misc function performing operations on datasets.

All the functions defined in this module must accept dataset as the first argument since they are bound to Dataset class in the trailer.

Classes [hide private]
  SequenceStats
Simple helper to provide representation of sequence statistics
Functions [hide private]
 
zscore(dataset, mean=None, std=None, perchunk=True, baselinelabels=None, pervoxel=True, targetdtype='float64')
Z-Score the samples of a Dataset (in-place).
source code
 
aggregateFeatures(dataset, fx=N.mean)
Apply a function to each row of the samples matrix of a dataset.
source code
 
removeInvariantFeatures(dataset)
Returns a new dataset with all invariant features removed.
source code
 
coarsenChunks(source, nchunks=4)
Change chunking of the dataset
source code
 
getSamplesPerChunkLabel(dataset)
Returns an array with the number of samples per label in each chunk.
source code

Imports: isSequenceType, N, Dataset, datasetmethod, table2string, getBreakPoints, externals, warning, debug, detrend


Function Details [hide private]

zscore(dataset, mean=None, std=None, perchunk=True, baselinelabels=None, pervoxel=True, targetdtype='float64')

source code 

Z-Score the samples of a Dataset (in-place).

mean and std can be used to pass custom values to the z-scoring. Both may be scalars or arrays.

All computations are done in place. Data upcasting is done automatically if necessary into targetdtype

If baselinelabels provided, and mean or std aren't provided, it would compute the corresponding measure based only on labels in baselinelabels

If perchunk is True samples within the same chunk are z-scored independent of samples from other chunks, e.i. mean and standard deviation are calculated individually.

Decorators:
  • @datasetmethod

aggregateFeatures(dataset, fx=N.mean)

source code 

Apply a function to each row of the samples matrix of a dataset.

The functor given as fx has to honour an axis keyword argument in the way that NumPy used it (e.g. NumPy.mean, var).

Returns:
a new Dataset object with the aggregated feature(s).
Decorators:
  • @datasetmethod

removeInvariantFeatures(dataset)

source code 
Returns a new dataset with all invariant features removed.
Decorators:
  • @datasetmethod

coarsenChunks(source, nchunks=4)

source code 

Change chunking of the dataset

Group chunks into groups to match desired number of chunks. Makes sense if originally there were no strong groupping into chunks or each sample was independent, thus belonged to its own chunk

Parameters:
  • source (Dataset or list of chunk ids) - dataset or list of chunk ids to operate on. If Dataset, then its chunks get modified
  • nchunks (int) - desired number of chunks
Decorators:
  • @datasetmethod

getSamplesPerChunkLabel(dataset)

source code 

Returns an array with the number of samples per label in each chunk.

Array shape is (chunks x labels).

Parameters:
  • dataset, Dataset - Source dataset.
Decorators:
  • @datasetmethod