| Home | Trees | Indices | Help |
|
|---|
|
|
Expands the input samples by applying to them one or more functions provided.
The functions to be applied are specified by a list [f_0, ..., f_k], where
f_i, for 0 <= i <= k, denotes a particular function.
The input data given to these functions is a two-dimensional array and
the output is another two-dimensional array. The dimensionality of the output
should depend only on the dimensionality of the input.
Given a two-dimensional input array x, the output of the node
is then [f_0(x), ..., f_k(x)], that is, the concatenation of each one of
the computed arrays f_i(x).
This node has been designed to facilitate nonlinear, fixed but arbitrary
transformations of the data samples within MDP flows.
**Example**::
>>> import mdp
>>> from mdp import numx
>>> def identity(x): return x
>>> def u3(x): return numx.absolute(x)**3 #A simple nonlinear transformation
>>> def norm2(x): #Computes the norm of each sample returning an Nx1 array
>>> return ((x**2).sum(axis=1)**0.5).reshape((-1,1))
>>> x = numx.array([[-2., 2.], [0.2, 0.3], [0.6, 1.2]])
>>> gen = mdp.nodes.GeneralExpansionNode(funcs=[identity, u3, norm2])
>>> print(gen.execute(x))
>>> [[-2. 2. 8. 8. 2.82842712]
>>> [ 0.2 0.3 0.008 0.027 0.36055513]
>>> [ 0.6 1.2 0.216 1.728 1.34164079]]
Original code contributed by Alberto Escalante.
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
Inherited from Inherited from Inherited from |
|||
| Inherited from Node | |||
|---|---|---|---|
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
Inherited from |
|||
| Inherited from Node | |||
|---|---|---|---|
|
_train_seq List of tuples:: |
|||
|
dtype dtype |
|||
|
input_dim Input dimensions |
|||
|
output_dim Output dimensions |
|||
|
supported_dtypes Supported dtypes |
|||
|
|||
Short argument description:
``funcs``
list of functions f_i that realize the expansion.
|
|
Process the data contained in `x`. If the object is still in the training phase, the function `stop_training` will be called. `x` is a matrix having different variables on different columns and observations on the rows. By default, subclasses should overwrite `_execute` to implement their execution phase. The docstring of the `_execute` method overwrites this docstring.
|
The expanded dim is computed by directly applying the expansion functions f_i to a zero input of dimension n.
|
Return True if the node can be inverted, False otherwise.
|
Return True if the node can be trained, False otherwise.
|
Return the individual output sizes of each expansion function when the input has lenght n. |
Calculate a pseudo inverse of the expansion using
scipy.optimize.
``use_hint``
when calculating a pseudo inverse of the expansion,
the hint determines the starting point for the approximation.
For details on this parameter see the function
``invert_exp_funcs2`` in ``mdp.utils.routines.py``.
This method requires scipy.
|
| Home | Trees | Indices | Help |
|
|---|
| Generated by Epydoc 3.0.1 on Thu Mar 10 15:27:36 2016 | http://epydoc.sourceforge.net |