A 'CircularOnlineFlow' is a cyclic sequence of online/non-trainable nodes that are trained and executed
together to form a more complex algorithm. This type of flow is useful when one needs to train the nodes
internally for several iterations using stored inputs before training with the next external input.
input=x(i) -> [node1, node2, node3] -> output=y' ----External input training---- (1 iteration)
input=y' -> [node1, node2, node3] -> output=y' ---- Internal
... input (n-1 iterations)
input=y' -> [node1, node2, node3] -> output=y(i) training----
This type of processing is especially useful for implementing control algorithms, reinforcement learning, etc.
The input and the output nodes of the flow can be changed at any time using the functions "set_input_node"
and "set_output_node".
CircularOnlineFlow also supports training nodes while ignoring external input data at all times. In this case,
the flow iterates everytime using the previously stored output as the input. Input data can be arbitrary (with same
input_dim and dtype) and is only used as a clock signal to trigger flow processing.
See the docstring of the train method for more information about different training types.
Crash recovery is optionally available: in case of failure the current
state of the flow is saved for later inspection.
CircularOnlineFlow objects are Python containers. Most of the builtin 'list'
methods are available. CircularOnlineFlow can be saved or copied using the
corresponding 'save' and 'copy' methods.
|
|
|
|
|
|
|
|
|
__init__(self,
flow,
crash_recovery=False,
verbose=False)
flow - a list of nodes. |
|
|
|
|
|
|
|
|
|
|
|
append(flow,
node)
append node to flow end |
|
|
|
execute(self,
iterable,
nodenr=None)
Process the data through all nodes between input and the output node.
This is functionally similar to the execute method of an OnlineFlow. |
|
|
|
extend(flow,
iterable)
extend flow by appending
elements from the iterable |
|
|
|
|
|
ignore_input(self,
flag)
CircularOnlineFlow also supports training nodes while ignoring external input data at all times.
This mode is enabled/disabled using this method. See train method docstring for information on
different training modes. |
|
|
|
insert(flow,
index,
node)
insert node before index |
|
|
|
reset_output_node(self)
Resets the output node to the last node of the provided node sequence |
|
|
|
set_flow_iterations(self,
n)
This method sets the number of total flow iterations:
If self._ignore_input is False, then the total flow iterations = 1 external + (n-1) internal iterations.
If self._ignore input is True, then the total flow iterations = n internal iterations.
See train method docstring for information on different training modes. |
|
|
|
|
|
|
|
set_stored_input(self,
x)
CircularOnlineFlow also supports training nodes while ignoring external input data at all times.
In this case, the flow iterates every time using an initially stored input that can be set using this method. |
|
|
|
train(self,
data_iterables)
Train all trainable-nodes in the flow. |
|
|
Inherited from unreachable.newobject :
__long__ ,
__native__ ,
__nonzero__ ,
__unicode__ ,
next
Inherited from object :
__delattr__ ,
__format__ ,
__getattribute__ ,
__hash__ ,
__new__ ,
__reduce__ ,
__reduce_ex__ ,
__setattr__ ,
__sizeof__ ,
__subclasshook__
|
|
|
|
|
|
|
|
_train_node(self,
data_iterable,
nodenr)
Train a single node in the flow. |
|
|
|
__call__(self,
iterable,
nodenr=None)
Calling an instance is equivalent to call its 'execute' method. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
copy(self,
protocol=None)
Return a deep copy of the flow. |
|
|
|
inverse(self,
iterable)
Process the data through all nodes in the flow backwards
(starting from the last node up to the first node) by calling the
inverse function of each node. Of course, all nodes in the
flow must be invertible. |
|
|
node
|
pop(flow,
index=...)
remove and return node at index
(default last) |
|
|
|
save(self,
filename,
protocol=-1)
Save a pickled serialization of the flow to 'filename'.
If 'filename' is None, return a string. |
|
|
|
|