Multivariate Pattern Analysis in Python

# mvpa2.mappers.fx.FxMapper

class `mvpa2.mappers.fx.``FxMapper`(axis, fx, fxargs=None, uattrs=None, attrfx='merge', order='uattrs')

  Apply a custom transformation to (groups of) samples or features.

  Notes

  Available conditional attributes:

  - `calling_time+`: Time (in seconds) it took to call the node
  - `raw_results`: Computed results before invoking postproc. Stored only if postproc is not None.
  - `trained_dataset`: The dataset it has been trained on
  - `trained_nsamples+`: Number of samples it has been trained on
  - `trained_targets+`: Set of unique targets (or any other space) it has been trained on (if present in the dataset trained on)
  - `training_time+`: Time (in seconds) it took to train the learner

  (Conditional attributes enabled by default suffixed with `+`)

  Attributes

  `attrfx` |
  `auto_train` | Whether the Learner performs automatic trainingwhen called untrained.
  `axis` |
  `descr` | Description of the object if any
  `force_train` | Whether the Learner enforces training upon every call.
  `fx` |
  `fxargs` |
  `order` |
  `pass_attr` | Which attributes of the dataset or self.ca to pass into result dataset upon call
  `postproc` | Node to perform post-processing of results
  `space` | Processing space name of this node
  `uattrs` |

  Methods

  `__call__`(ds) |
  `forward`(data) | Map data from input to output space.
  `forward1`(data) | Wrapper method to map single samples.
  `generate`(ds) | Yield processing results.
  `get_postproc`() | Returns the post-processing node or None.
  `get_space`() | Query the processing space name of this node.
  `reset`() |
  `reverse`(data) | Reverse-map data from output back into input space.
  `reverse1`(data) | Wrapper method to map single samples.
  `set_postproc`(node) | Assigns a post-processing node
  `set_space`(name) | Set the processing space name of this node.
  `train`(ds) | The default implementation calls `_pretrain()`, `_train()`, and finally `_posttrain()`.
  `untrain`() | Reverts changes in the state of this node caused by previous training

  Parameters:

  axis : {‘samples’, ‘features’}

  fx : callable

  fxargs : tuple

  > Passed as *args to `fx`

  uattrs : list

  > List of attribute names to consider. All possible combinations of unique elements of these attributes are used to determine the sample groups to operate on.

  attrfx : callable

  > Functor that is called with each sample attribute elements matching the respective samples group. By default the unique value is determined. If the content of the attribute is not uniform for a samples group a unique string representation is created. If `None`, attributes are not altered.

  order : {‘uattrs’, ‘occurrence’, None}

  > If which order groups should be merged together. If `None` (default before 2.3.1), the order is imposed only by the order of `uattrs` as keys in the dictionary, thus can vary from run to run. If `'occurrence'`, groups will be ordered by the first occurrence of group samples in original dataset. If `'uattrs'`, groups will be sorted by the values of uattrs with follow-up attr having higher importance for ordering (e .g. `uattrs=['targets', 'chunks']` would order groups first by `chunks` and then by `targets` within each chunk).

  enable_ca : None or list of str

  > Names of the conditional attributes which should be enabled in addition to the default ones

  disable_ca : None or list of str

  > Names of the conditional attributes which should be disabled

  Attributes

  `attrfx` |
  `auto_train` | Whether the Learner performs automatic trainingwhen called untrained.
  `axis` |
  `descr` | Description of the object if any
  `force_train` | Whether the Learner enforces training upon every call.
  `fx` |
  `fxargs` |
  `order` |
  `pass_attr` | Which attributes of the dataset or self.ca to pass into result dataset upon call
  `postproc` | Node to perform post-processing of results
  `space` | Processing space name of this node
  `uattrs` |

  Methods

  `__call__`(ds) |
  `forward`(data) | Map data from input to output space.
  `forward1`(data) | Wrapper method to map single samples.
  `generate`(ds) | Yield processing results.
  `get_postproc`() | Returns the post-processing node or None.
  `get_space`() | Query the processing space name of this node.
  `reset`() |
  `reverse`(data) | Reverse-map data from output back into input space.
  `reverse1`(data) | Wrapper method to map single samples.
  `set_postproc`(node) | Assigns a post-processing node
  `set_space`(name) | Set the processing space name of this node.
  `train`(ds) | The default implementation calls `_pretrain()`, `_train()`, and finally `_posttrain()`.
  `untrain`() | Reverts changes in the state of this node caused by previous training

  `attrfx`
  `axis`
  `fx`
  `fxargs`
  `is_trained` = True

    Indicate that this mapper is always trained.

  `order`
  `uattrs`