tsfuse.computation
- class tsfuse.computation.Graph(nodes=None)
Computation graph.
A computation graph is a directed acyclic graph (DAG) whose nodes areconnected by edges that represent the flow of the data. There are three types of nodes:
Inputs: placeholders for the input time series data.
Constants: values that do not depend on the input data.
Transformers: computation steps which create new data from existing data. The input of a transformer is given by its parent nodes. See tsfuse.transformers for an overview of all available transformers.
The outputs of a computation graph are the values computed by all transformers that either have no outgoing edges, or are marked as an output node.
- Parameters
nodes (list(Node), optional) – Initialize the computation graph with a list of nodes. Nodes can also be added later using
Grap add_node()
- transformers
Transformer nodes.
- Type
list(Transformer)
- add_node(node, **kwargs)
Add a node to the computation graph.
- transform(X, return_dataframe=True, chunk_size=None, n_jobs=None)
Compute all outputs of the graph.
- Parameters
X (dict(int or str: Collection)) – Data collections used as inputs for the graph. Collection
X[i]
will be used forgraph.inputs[i]
.return_dataframe (bool, default True) – Return the graph’s output as a pandas DataFrame.
chunk_size (int, optional) – Split the input data collections into chunks
c
withc.shape[0] == chunk_size
and process each block separately.n_jobs (int, optional) – Number of chunks to process simultaneously, only relevant if a chunk size is specified.
- to_dot()
Visualize the computation graph.
- class tsfuse.computation.Node(parents=None, is_output=None)
Node of a computation graph.
- Parameters
parents (list(Node), optional) – Parent nodes.
is_output (bool, optional) – True if the node must be an output node or False if the node should not be an output node. By default, the node is an output node if it is not used as a parent for another node.
- is_input
True if the node is an input node.
- Type
bool
- is_output
True if the node is an output node.
- Type
bool
- class tsfuse.computation.Input(input_id)
Node that serves as the input of a computation graph.
- Parameters
input_id (int or str) – Input identifier.
- class tsfuse.computation.Constant(data)
Node that produces a constant value, given as
Collection
object.- Parameters
data (int, float, str or object) – Output data.
- class tsfuse.computation.Transformer(*parents, **kwargs)
Transformer node.
- check_preconditions(*collections)
Check that the preconditions are satisfied.
- Parameters
*collections –
Collection
objects used as input.- Returns
satisfied
- Return type
bool