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/set_input_dim, get/set_output_dim, and get/set_dtype.
|
|||
__metaclass__ This Metaclass is meant to overwrite doc strings of methods like execute, stop_training, inverse with the ones defined in the corresponding private methods _execute, _stop_training, _inverse, etc... |
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
Inherited from |
|
|||
_train_seq List of tuples: [(training-phase1, stop-training-phase1), (training-phase2, stop_training-phase2), ... |
|||
dtype dtype |
|||
input_dim Input dimensions |
|||
output_dim Output dimensions |
|||
supported_dtypes Supported dtypes |
|||
Inherited from |
|
|
Calling an instance of Node is equivalent to call its 'execute' method. |
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 numpy.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. |
Helper function to cast arrays to the internal dtype. |
|
|
|
|
|
Return a deep copy of the node. Protocol is the pickle protocol. |
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. |
Return the index of the current training phase. The training phases are defined in the list self._train_seq. |
Return dtype. |
Return input dimensions. |
Return output dimensions. |
Return the number of training phases still to accomplish. If the node is not trainable then the return value is 0. |
Return dtypes supported by the node as a list of numpy.dtype objects. Note that subclasses should overwrite self._get_supported_dtypes when needed. |
Invert 'y'. 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. |
Return True if the node can be inverted, False otherwise. |
Return True if the node can be trained, False otherwise. |
Return True if the node is in the training phase, False otherwise. |
Save a pickled serialization of the node to 'filename'. If 'filename' is None, return a string. Note: the pickled Node is not guaranteed to be upward or backward 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 their stop-training. The docstring of the '_stop_training' method overwrites this docstring. |
Update the internal structures according to the input data 'x'. 'x' is a matrix having different variables on different columns and observations on the rows. By default, subclasses should overwrite _train to implement their training phase. The docstring of the '_train' method overwrites this docstring. |
|
_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 Fri Oct 9 06:08:49 2009 | http://epydoc.sourceforge.net |