Table Of Contents

Previous topic

featsel.base

Next topic

featsel.ifs

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.

featsel.helpers

Module: featsel.helpers

Inheritance diagram for mvpa.featsel.helpers:

Classes

BestDetector

class mvpa.featsel.helpers.BestDetector(func=<built-in function min>, lastminimum=False)

Bases: object

Determine whether the last value in a sequence is the best one given some criterion.

Initialize with number of steps

Parameters:
  • fun (functor) – Functor to select the best results. Defaults to min
  • lastminimum (bool) – Toggle whether the latest or the earliest minimum is used as optimal value to determine the stopping criterion.
bestindex

ElementSelector

class mvpa.featsel.helpers.ElementSelector(mode='discard', **kwargs)

Bases: mvpa.misc.state.ClassWithCollections

Base class to implement functors to select some elements based on a sequence of values.

Note

Available state variables:

  • True+: Store number of discarded elements.

(States enabled by default are listed with +)

See also

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

ClassWithCollections

Cheap initialization.

Parameters:
  • mode ([‘discard’, ‘select’]) – Decides whether to select or to discard features.
  • enable_states (None or list of basestring) – Names of the state variables which should be enabled additionally to default ones
  • disable_states (None or list of basestring) – Names of the state variables which should be disabled
mode

FixedErrorThresholdStopCrit

class mvpa.featsel.helpers.FixedErrorThresholdStopCrit(threshold)

Bases: mvpa.featsel.helpers.StoppingCriterion

Stop computation if the latest error drops below a certain threshold.

Initialize with threshold.

Parameters:threshold (float [0,1]) – Error threshold.
threshold

FixedNElementTailSelector

class mvpa.featsel.helpers.FixedNElementTailSelector(nelements, **kwargs)

Bases: mvpa.featsel.helpers.TailSelector

Given a sequence, provide set of IDs for a fixed number of to be selected elements.

Note

Available state variables:

  • True+: Store number of discarded elements.

(States enabled by default are listed with +)

See also

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

TailSelector

Cheap initialization.

Parameters:
  • nelements (int) – Number of elements to select/discard.
  • enable_states (None or list of basestring) – Names of the state variables which should be enabled additionally to default ones
  • disable_states (None or list of basestring) – Names of the state variables which should be disabled
  • tail ([‘lower’, ‘upper’]) – Choose the tail to be processed.
  • sort (bool) – Flag whether selected IDs will be sorted. Disable if not necessary to save some CPU cycles.
  • mode ([‘discard’, ‘select’]) – Decides whether to select or to discard features.
nelements

FractionTailSelector

class mvpa.featsel.helpers.FractionTailSelector(felements, **kwargs)

Bases: mvpa.featsel.helpers.TailSelector

Given a sequence, provide Ids for a fraction of elements

Note

Available state variables:

  • True+: Store number of discarded elements.

(States enabled by default are listed with +)

See also

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

TailSelector

Cheap initialization.

Parameters:
  • felements (float (0,1.0]) – Fraction of elements to select/discard. Note: Even when 0.0 is specified at least one element will be selected.
  • enable_states (None or list of basestring) – Names of the state variables which should be enabled additionally to default ones
  • disable_states (None or list of basestring) – Names of the state variables which should be disabled
  • tail ([‘lower’, ‘upper’]) – Choose the tail to be processed.
  • sort (bool) – Flag whether selected IDs will be sorted. Disable if not necessary to save some CPU cycles.
  • mode ([‘discard’, ‘select’]) – Decides whether to select or to discard features.
felements

MultiStopCrit

class mvpa.featsel.helpers.MultiStopCrit(crits, mode='or')

Bases: mvpa.featsel.helpers.StoppingCriterion

Stop computation if the latest error drops below a certain threshold.

Parameters:
  • crits (list of StoppingCriterion instances) – For each call to MultiStopCrit all of these criterions will be evaluated.
  • mode (any of (‘and’, ‘or’)) – Logical function to determine the multi criterion from the set of base criteria.

NBackHistoryStopCrit

class mvpa.featsel.helpers.NBackHistoryStopCrit(bestdetector=<mvpa.featsel.helpers.BestDetector object at 0x88b1ed0>, steps=10)

Bases: mvpa.featsel.helpers.StoppingCriterion

Stop computation if for a number of steps error was increasing

Initialize with number of steps

Parameters:
  • bestdetector (BestDetector instance) – used to determine where the best error is located.
  • steps (int) – How many steps to check after optimal value.
steps

NStepsStopCrit

class mvpa.featsel.helpers.NStepsStopCrit(steps)

Bases: mvpa.featsel.helpers.StoppingCriterion

Stop computation after a certain number of steps.

Initialize with number of steps.

Parameters:steps (int) – Number of steps after which to stop.
steps

RangeElementSelector

class mvpa.featsel.helpers.RangeElementSelector(lower=None, upper=None, inclusive=False, mode='select', **kwargs)

Bases: mvpa.featsel.helpers.ElementSelector

Select elements based on specified range of values

Note

Available state variables:

  • True+: Store number of discarded elements.

(States enabled by default are listed with +)

See also

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

ElementSelector

Initialization RangeElementSelector

Parameters:
  • lower – If not None – select elements which are above of specified value
  • upper – If not None – select elements which are lower of specified value
  • inclusive – Either to include end points
  • mode – overrides parent’s default to be ‘select’ since it is more native for RangeElementSelector XXX TODO – unify??
  • enable_states (None or list of basestring) – Names of the state variables which should be enabled additionally to default ones
  • disable_states (None or list of basestring) – Names of the state variables which should be disabled

upper could be lower than lower – then selection is done on values <= lower or >=upper (ie tails). This would produce the same result if called with flipped values for mode and inclusive.

If no upper no lower is set, assuming upper,lower=0, thus outputing non-0 elements

StoppingCriterion

class mvpa.featsel.helpers.StoppingCriterion

Bases: object

Base class for all functors to decide when to stop RFE (or may be general optimization... so it probably will be moved out into some other module

TailSelector

class mvpa.featsel.helpers.TailSelector(tail='lower', sort=True, **kwargs)

Bases: mvpa.featsel.helpers.ElementSelector

Select elements from a tail of a distribution.

The default behaviour is to discard the lower tail of a given distribution.

Note

Available state variables:

  • True+: Store number of discarded elements.

(States enabled by default are listed with +)

See also

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

ElementSelector

Initialize TailSelector

Parameters:
  • tail ([‘lower’, ‘upper’]) – Choose the tail to be processed.
  • sort (bool) – Flag whether selected IDs will be sorted. Disable if not necessary to save some CPU cycles.
  • enable_states (None or list of basestring) – Names of the state variables which should be enabled additionally to default ones
  • disable_states (None or list of basestring) – Names of the state variables which should be disabled
  • mode ([‘discard’, ‘select’]) – Decides whether to select or to discard features.