Package mdp :: Package nodes :: Class IncSFANode
[hide private]
[frames] | no frames]

Class IncSFANode


Incremental Slow Feature Analysis (IncSFA) extracts the slowly varying components from the input data incrementally.

Reference

More information about IncSFA can be found in Kompella V.R, Luciw M. and Schmidhuber J., Incremental Slow Feature Analysis: Adaptive Low-Complexity Slow Feature Updating from High-Dimensional Input Streams, Neural Computation, 2012.

Instance Methods [hide private]
 
__init__(self, eps=0.05, whitening_output_dim=None, remove_mean=True, avg_n=None, amn_params=(20, 200, 2000, 3), init_pca_vectors=None, init_mca_vectors=None, input_dim=None, output_dim=None, dtype=None, numx_rng=None)
Initialize an object of type 'SFANode'.
str
__repr__(self)
Print all args.
 
_check_params(self, x)
Initialize parameters.
 
_check_train_args(self, x, *args, **kwargs)
 
_execute(self, x)
Return slow feature response.
 
_inverse(self, y)
Return inverse of the slow feature response.
 
_set_dtype(self, t)
 
_set_input_dim(self, n)
 
_set_numx_rng(self, rng)
 
_set_output_dim(self, n)
 
_step_train(self, x)
 
_train(self, x, new_episode=None)
Update slow features.
 
execute(self, x)
Return slow feature response.
 
inverse(self, y)
Return inverse of the slow feature response.
 
train(self, x, new_episode=None)
Update slow features.

Inherited from unreachable.newobject: __long__, __native__, __nonzero__, __unicode__, next

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __subclasshook__

    Inherited from OnlineNode
 
__add__(self, other)
 
_check_input(self, x)
 
_get_supported_training_types(self)
Return the list of training types supported by this node.
 
_get_train_seq(self)
 
_pre_execution_checks(self, x)
This method contains all pre-execution checks. It can be used when a subclass defines multiple execution methods.
 
_pre_inversion_checks(self, y)
This method contains all pre-inversion checks.
 
get_current_train_iteration(self)
Return the index of the current training iteration.
 
get_numx_rng(self)
Return input dimensions.
 
set_numx_rng(self, rng)
Set numx random number generator. Note that subclasses should overwrite self._set_numx_rng when needed.
 
set_training_type(self, training_type)
Sets the training type
 
stop_training(self, *args, **kwargs)
Stop the training phase.
    Inherited from Node
 
__call__(self, x, *args, **kwargs)
Calling an instance of Node is equivalent to calling its execute method.
 
__str__(self)
str(x)
 
_check_output(self, y)
 
_get_supported_dtypes(self)
Return the list of dtypes supported by this node.
 
_if_training_stop_training(self)
 
_refcast(self, x)
Helper function to cast arrays to the internal dtype.
 
_stop_training(self, *args, **kwargs)
 
copy(self, protocol=None)
Return a deep copy of the node.
 
get_current_train_phase(self)
Return the index of the current training phase.
 
get_dtype(self)
Return dtype.
 
get_input_dim(self)
Return input dimensions.
 
get_output_dim(self)
Return output dimensions.
 
get_remaining_train_phase(self)
Return the number of training phases still to accomplish.
 
get_supported_dtypes(self)
Return dtypes supported by the node as a list of numpy.dtype objects.
 
has_multiple_training_phases(self)
Return True if the node has multiple training phases.
 
is_training(self)
Return True if the node is in the training phase, False otherwise.
 
save(self, filename, protocol=-1)
Save a pickled serialization of the node to filename. If filename is None, return a string.
 
set_dtype(self, t)
Set internal structures' dtype.
 
set_input_dim(self, n)
Set input dimensions.
 
set_output_dim(self, n)
Set output dimensions.
Static Methods [hide private]
 
_pseudo_check_fn(node, x)
 
_pseudo_train_fn(node, x)
    Inherited from Node
 
is_invertible()
Return True if the node can be inverted, False otherwise.
 
is_trainable()
Return True if the node can be trained, False otherwise.
Instance Variables [hide private]
  sf
Slow feature vectors
  sf_change
Difference in slow features after update
  wv
Whitening vectors
Properties [hide private]
numpy.ndarray init_mca_vectors
Return initialized minor components.
numpy.ndarray init_pca_vectors
Return the initialized whitening vectors.
  init_slow_features
Return the initialized slow features.

Inherited from object: __class__

    Inherited from OnlineNode
  _train_seq
List of tuples:
  numx_rng
Numpy seeded random number generator
  training_type
Training type (Read only)
    Inherited from Node
  dtype
dtype
  input_dim
Input dimensions
  output_dim
Output dimensions
  supported_dtypes
Supported dtypes
Method Details [hide private]

__init__(self, eps=0.05, whitening_output_dim=None, remove_mean=True, avg_n=None, amn_params=(20, 200, 2000, 3), init_pca_vectors=None, init_mca_vectors=None, input_dim=None, output_dim=None, dtype=None, numx_rng=None)
(Constructor)

 
Initialize an object of type 'SFANode'.
Parameters:
  • eps (float) - Learning rate (default: 0.1)
  • whitening_output_dim (int) - Whitening output dimension. (default: input_dim)
  • remove_mean (bool) - Remove input mean incrementally (default: True)
  • avg_n - When set, the node updates an exponential weighted moving average. avg_n intuitively denotes a window size. For a large avg_n, avg_n samples represents about 86% of the total weight. (Default:None)
  • amn_params (tuple) - PCA amnesic parameters. Default set to (n1=20,n2=200,m=2000,c=3). For n < n1, ~ moving average. For n1 < n < n2 - Transitions from moving average to amnesia. m denotes the scaling param and c typically should be between (2-4). Higher values will weigh recent data.
  • init_pca_vectors (numpy.ndarray) - Initial whitening vectors. Default - randomly set
  • init_mca_vectors (numpy.ndarray) - Initial mca vectors. Default - randomly set
  • input_dim (int) - The input dimensionality.
  • output_dim (int) - The output dimensionality.
  • dtype (numpy.dtype or str) - The datatype.
  • numx_rng - Random number generator. (Optional)
Overrides: object.__init__

__repr__(self)
(Representation operator)

 
Print all args.
Returns: str
A string that contains all argument names and their values.
Overrides: object.__repr__

_check_params(self, x)

 
Initialize parameters.

Overrides: OnlineNode._check_params

_check_train_args(self, x, *args, **kwargs)

 
Overrides: Node._check_train_args

_execute(self, x)

 
Return slow feature response.

:return: Slow feature response.

Overrides: Node._execute

_inverse(self, y)

 
Return inverse of the slow feature response.

:return: The inverse of the slow feature response.

Overrides: Node._inverse

_pseudo_check_fn(node, x)
Static Method

 

_pseudo_train_fn(node, x)
Static Method

 

_set_dtype(self, t)

 
Overrides: Node._set_dtype

_set_input_dim(self, n)

 
Overrides: Node._set_input_dim

_set_numx_rng(self, rng)

 
Overrides: OnlineNode._set_numx_rng

_set_output_dim(self, n)

 
Overrides: Node._set_output_dim

_step_train(self, x)

 

_train(self, x, new_episode=None)

 
Update slow features.

:param new_episode: Set new_episode to True to ignore taking erroneous
    derivatives between the episodes of training data.
:type new_episode: bool

Overrides: Node._train

execute(self, x)

 
Return slow feature response.
Returns:
Slow feature response.
Overrides: Node.execute

inverse(self, y)

 
Return inverse of the slow feature response.
Returns:
The inverse of the slow feature response.
Overrides: Node.inverse

train(self, x, new_episode=None)

 
Update slow features.
Parameters:
  • new_episode (bool) - Set new_episode to True to ignore taking erroneous derivatives between the episodes of training data.
Overrides: Node.train

Instance Variable Details [hide private]

sf

Slow feature vectors

sf_change

Difference in slow features after update

wv

Whitening vectors

Property Details [hide private]

init_mca_vectors

Return initialized minor components.
Get Method:
unreachable.init_mca_vectors(self) - Return initialized minor components.
Type:
numpy.ndarray

init_pca_vectors

Return the initialized whitening vectors.
Get Method:
unreachable.init_pca_vectors(self) - Return the initialized whitening vectors.
Type:
numpy.ndarray

init_slow_features

Return the initialized slow features.
Get Method:
unreachable.init_slow_features(self) - Return the initialized slow features.