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

Class iGSFANode


This node implements "information-preserving graph-based SFA (iGSFA)", which is the main component of hierarchical iGSFA (HiGSFA).

For further information, see: Escalante-B., A.-N. and Wiskott, L., "Improved graph-based {SFA}: Information preservation complements the slowness principle", e-print arXiv:1601.03945, http://arxiv.org/abs/1601.03945, 2017.

Instance Methods [hide private]
 
__init__(self, pre_expansion_node_class=None, pre_expansion_out_dim=None, expansion_funcs=None, expansion_output_dim=None, expansion_starting_point=None, max_length_slow_part=None, slow_feature_scaling_method=None, delta_threshold=1.999, reconstruct_with_sfa=False, verbose=False, input_dim=None, output_dim=None, dtype=None, **argv)
Initializes the iGSFA node.
 
_execute(self, x)
Extracts iGSFA features from some data.
 
_inverse(self, y, linear_inverse=True)
This method approximates an inverse function to the feature extraction.
 
_stop_training(self, verbose=None)
 
_train(self, x, block_size=None, train_mode=None, node_weights=None, edge_weights=None, verbose=None, **argv)
Trains an iGSFA node on data 'x'
 
execute(self, x)
Extracts iGSFA features from some data. The node must have been already trained.
 
inverse(self, y, linear_inverse=True)
This method approximates an inverse function to the feature extraction.
 
linear_inverse(self, y, verbose=True)
Linear inverse approximation method.
 
multiple_train(self, x, block_size=None, train_mode=None, node_weights=None, edge_weights=None, verbose=None)
This function should not be called directly. Use instead the train method, which will decide whether multiple-training is enabled, and call this function if needed.
 
nonlinear_inverse(self, y, verbose=None)
Non-linear inverse approximation method.
 
stop_training(self, verbose=None)
Stop the training phase.
 
train(self, x, block_size=None, train_mode=None, node_weights=None, edge_weights=None, verbose=None, **argv)
Trains an iGSFA node on data 'x'

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 Node
 
__add__(self, other)
 
__call__(self, x, *args, **kwargs)
Calling an instance of Node is equivalent to calling its execute method.
 
__repr__(self)
repr(x)
 
__str__(self)
str(x)
 
_check_input(self, x)
 
_check_output(self, y)
 
_check_train_args(self, x, *args, **kwargs)
 
_get_supported_dtypes(self)
Return the list of dtypes supported by this node.
 
_get_train_seq(self)
 
_if_training_stop_training(self)
 
_pre_execution_checks(self, x)
This method contains all pre-execution checks.
 
_pre_inversion_checks(self, y)
This method contains all pre-inversion checks.
 
_refcast(self, x)
Helper function to cast arrays to the internal dtype.
 
_set_dtype(self, t)
 
_set_input_dim(self, n)
 
_set_output_dim(self, n)
 
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]
 
_is_invertible()
 
is_trainable()
Return True if the node can be trained, False otherwise.
    Inherited from Node
 
is_invertible()
Return True if the node can be inverted, False otherwise.
Properties [hide private]

Inherited from object: __class__

    Inherited from Node
  _train_seq
List of tuples:
  dtype
dtype
  input_dim
Input dimensions
  output_dim
Output dimensions
  supported_dtypes
Supported dtypes
Method Details [hide private]

__init__(self, pre_expansion_node_class=None, pre_expansion_out_dim=None, expansion_funcs=None, expansion_output_dim=None, expansion_starting_point=None, max_length_slow_part=None, slow_feature_scaling_method=None, delta_threshold=1.999, reconstruct_with_sfa=False, verbose=False, input_dim=None, output_dim=None, dtype=None, **argv)
(Constructor)

 
Initializes the iGSFA node.
pre_expansion_node_class: a node class. An instance of this class is
    used to filter the data before the expansion.
pre_expansion_out_dim: the output dimensionality of the
    above-mentioned node.
expansion_funcs: a list of expansion functions to be applied before
    GSFA.
expansion_output_dim: this parameter is used to specify an output
    dimensionality for some expansion functions.
expansion_starting_point: this parameter is also used by some specific
    expansion functions.
max_length_slow_part: fixes an upper bound to the size of the slow
    part, which is convenient for computational reasons.
slow_feature_scaling_method: the method used to scale the slow
    features. Valid entries are: None, "sensitivity_based" (default),
    "data_dependent", and "QR_decomposition".
delta_threshold: this parameter has two different meanings depending
    on its type. If it is real valued (e.g., 1.99), it determines the
    parameter Delta_threshold, which is used to decide how many slow
    features are preserved, depending on their delta values. If it is
    integer (e.g., 20), it directly specifies the exact size of the
    slow part.
reconstruct_with_sfa: this Boolean parameter indicates whether the
    slow part is removed from the input before PCA is applied.

More information about parameters 'expansion_funcs' and
    'expansion_starting_point' can be found in the documentation of
    GeneralExpansionNode.

Note: Training sometimes finishes after a single call to the train
    method, unless multi-train is enabled (default). Multi-train is
    enabled by setting reconstruct_with_sfa=False and
    slow_feature_scaling_method in [None, "data_dependent"].
    This is necessary to support weight sharing in iGSFA layers
    (convolutional iGSFA layers).

Overrides: object.__init__

_execute(self, x)

 
Extracts iGSFA features from some data. The node must have been
already trained.

Overrides: Node._execute

_inverse(self, y, linear_inverse=True)

 
This method approximates an inverse function to the feature
extraction.

If linear_inverse is True, a linear method is used. Otherwise, a
gradient-based non-linear method is used.

Overrides: Node._inverse

_is_invertible()
Static Method

 

_stop_training(self, verbose=None)

 
Overrides: Node._stop_training

_train(self, x, block_size=None, train_mode=None, node_weights=None, edge_weights=None, verbose=None, **argv)

 
Trains an iGSFA node on data 'x'

The parameters:  block_size, train_mode, node_weights, and edge_weights
are passed to the training function of the corresponding gsfa node
inside iGSFA (node.gsfa_node).

Overrides: Node._train

execute(self, x)

 
Extracts iGSFA features from some data. The node must have been already trained.
Overrides: Node.execute

inverse(self, y, linear_inverse=True)

 

This method approximates an inverse function to the feature extraction.

If linear_inverse is True, a linear method is used. Otherwise, a gradient-based non-linear method is used.

Overrides: Node.inverse

is_trainable()
Static Method

 
Return True if the node can be trained, False otherwise.
Overrides: Node.is_trainable
(inherited documentation)

linear_inverse(self, y, verbose=True)

 
Linear inverse approximation method.

multiple_train(self, x, block_size=None, train_mode=None, node_weights=None, edge_weights=None, verbose=None)

 
This function should not be called directly. Use instead the train method, which will decide whether multiple-training is enabled, and call this function if needed.

nonlinear_inverse(self, y, verbose=None)

 

Non-linear inverse approximation method.

This method is experimental and should be used with care. Note: this function requires scipy.

stop_training(self, verbose=None)

 

Stop the training phase.

By default, subclasses should overwrite _stop_training to implement this functionality. The docstring of the _stop_training method overwrites this docstring.

Overrides: Node.stop_training

train(self, x, block_size=None, train_mode=None, node_weights=None, edge_weights=None, verbose=None, **argv)

 

Trains an iGSFA node on data 'x'

The parameters: block_size, train_mode, node_weights, and edge_weights are passed to the training function of the corresponding gsfa node inside iGSFA (node.gsfa_node).

Overrides: Node.train