mvpa2.mappers.som.SimpleSOMMapper

Inheritance diagram of SimpleSOMMapper

class mvpa2.mappers.som.SimpleSOMMapper(kshape, niter, learning_rate=0.005, iradius=None, distance_metric=None, initialization_func=None)

Mapper using a self-organizing map (SOM) for dimensionality reduction.

This mapper provides a simple, but pretty fast implementation of a self-organizing map using an unsupervised training algorithm. It performs a ND -> 2D mapping, which can for, example, be used for visualization of high-dimensional data.

This SOM implementation uses squared Euclidean distance to determine the best matching Kohonen unit and a Gaussian neighborhood influence kernel.

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

K Provide access to the Kohonen layer.
auto_train Whether the Learner performs automatic trainingwhen called untrained.
descr Description of the object if any
force_train Whether the Learner enforces training upon every call.
is_trained Whether the Learner is currently trained.
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

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:

kshape : (int, int)

Shape of the internal Kohonen layer. Currently, only 2D Kohonen layers are supported, although the length of an axis might be set to 1.

niter : int

Number of iteration during network training.

learning_rate : float

Initial learning rate, which will continuously decreased during network training.

iradius : float or None

Initial radius of the Gaussian neighborhood kernel radius, which will continuously decreased during network training. If None (default) the radius is set equal to the longest edge of the Kohonen layer.

distance_metric: callable or None

Kernel distance metric between elements in Kohonen layer. If None then Euclidean distance is used. Otherwise it should be a callable that accepts two input arguments x and y and returns the distance d through d=distance_metric(x,y)

initialization_func: callable or None

Initialization function to set self._K, that should take one argument with training samples and return an numpy array. If None, then values in the returned array are taken from a standard normal distribution.

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

K Provide access to the Kohonen layer.
auto_train Whether the Learner performs automatic trainingwhen called untrained.
descr Description of the object if any
force_train Whether the Learner enforces training upon every call.
is_trained Whether the Learner is currently trained.
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

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
K

Provide access to the Kohonen layer.

With some care.