Home | Trees | Indices | Help |
|
---|
|
A Node is the basic building block of an MDP application.
It represents a data processing element, like for example a learning algorithm, a data filter, or a visualization step. Each node can have one or more training phases, during which the internal structures are learned from training data (e.g. the weights of a neural network are adapted or the covariance matrix is estimated) and an execution phase, where new data can be processed forwards (by processing the data through the node) or backwards (by applying the inverse of the transformation computed by the node if defined).
Nodes have been designed to be applied to arbitrarily long sets of data: if the underlying algorithms supports it, the internal structures can be updated incrementally by sending multiple batches of data (this is equivalent to online learning if the chunks consists of single observations, or to batch learning if the whole data is sent in a single chunk). It is thus possible to perform computations on amounts of data that would not fit into memory or to generate data on-the-fly.
A Node also defines some utility methods, like for example copy and save, that return an exact copy of a node and save it in a file, respectively. Additional methods may be present, depending on the algorithm.
Node subclasses should take care of overwriting (if necessary) the functions is_trainable, _train, _stop_training, _execute, is_invertible, _inverse, _get_train_seq, and _get_supported_dtypes. If you need to overwrite the getters and setters of the node's properties refer to the docstring of get_input_dim/set_input_dim, get_output_dim/set_output_dim, and get_dtype/set_dtype.
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
Inherited from Inherited from |
|
|||
|
|||
|
|
|||
_train_seq List of tuples: |
|||
dtype dtype |
|||
input_dim Input dimensions |
|||
output_dim Output dimensions |
|||
supported_dtypes Supported dtypes |
|||
Inherited from |
|
|
|
If the input dimension and the output dimension are unspecified, they will be set when the train or execute method is called for the first time. If dtype is unspecified, it will be inherited from the data it receives at the first call of train or execute. Every subclass must take care of up- or down-casting the internal structures to match this argument (use _refcast private method when possible).
|
repr(x)
|
str(x)
|
|
|
|
|
Return the list of dtypes supported by this node. The types can be specified in any format allowed by dtype. |
|
|
|
This method contains all pre-execution checks. It can be used when a subclass defines multiple execution methods. |
This method contains all pre-inversion checks. It can be used when a subclass defines multiple inversion methods. |
|
|
|
|
|
|
|
Process the data contained in If the object is still in the training phase, the function
stop_training will be called.
By default, subclasses should overwrite _execute to implement their execution phase. The docstring of the _execute method overwrites this docstring. |
Return the index of the current training phase. The training phases are defined in the list self._train_seq. |
|
|
|
Return the number of training phases still to accomplish. If the node is not trainable then return 0. |
Return dtypes supported by the node as a list of dtype objects. Note that subclasses should overwrite self._get_supported_dtypes when needed. |
|
Invert If the node is invertible, compute the input x such that y = execute(x). By default, subclasses should overwrite _inverse to implement their inverse function. The docstring of the inverse method overwrites this docstring. |
|
|
|
Save a pickled serialization of the node to Note: the pickled Node is not guaranteed to be forwards or backwards compatible. |
Set internal structures' dtype. Perform sanity checks and then calls self._set_dtype(n), which is responsible for setting the internal attribute self._dtype. Note that subclasses should overwrite self._set_dtype when needed. |
Set input dimensions. Perform sanity checks and then calls self._set_input_dim(n), which is responsible for setting the internal attribute self._input_dim. Note that subclasses should overwrite self._set_input_dim when needed. |
Set output dimensions. Perform sanity checks and then calls self._set_output_dim(n), which is responsible for setting the internal attribute self._output_dim. Note that subclasses should overwrite self._set_output_dim when needed. |
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. |
Update the internal structures according to the input data
By default, subclasses should overwrite _train to implement their training phase. The docstring of the _train method overwrites this docstring. Note: a subclass supporting multiple training phases should implement the same signature for all the training phases and document the meaning of the arguments in the _train method doc-string. Having consistent signatures is a requirement to use the node in a flow. |
|
_train_seqList of tuples: [(training-phase1, stop-training-phase1), (training-phase2, stop_training-phase2), ...] By default: _train_seq = [(self._train, self._stop_training)]
|
dtypedtype |
input_dimInput dimensions
|
output_dimOutput dimensions
|
supported_dtypesSupported dtypes
|
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Tue Mar 8 12:39:48 2016 | http://epydoc.sourceforge.net |