Skip to content

temporian.run #

run(
    query: EventSetNodeCollection,
    input: NodeToEventSetMapping,
    verbose: int = 0,
    check_execution: bool = True,
    force_garbage_collector_interval: Optional[float] = 10,
) -> EventSetCollection

Evaluates EventSetNodes on EventSets.

Performs all computation defined by the graph between the query EventSetNodes and the input EventSets.

The result is returned in the same format as the query argument.

Single input output example
>>> input_evset = tp.event_set(timestamps=[1, 2, 3], features={"f": [0, 4, 10]})
>>> input_node = input_evset.node()
>>> output_node = input_node.moving_sum(5)
>>> output_evset = tp.run(output_node, input_evset)

>>> # Equivalent
>>> output_evset = output_node.run(input_evset)

>>> # Also equivalent
>>> output_evset = tp.run(output_node, {input_node: input_evset})
Multiple inputs and outputs example
>>> evset_1 = tp.event_set(timestamps=[1, 2, 3], features={"f1": [0.1, 42, 10]})
>>> evset_2 = tp.event_set(timestamps=[1, 2, 3],
...     features={"f2": [-1.5, 50, 30]},
...     same_sampling_as=evset_1
... )

>>> # Graph with 2 inputs and 2 steps
>>> input_1 = evset_1.node()
>>> input_2 = evset_2.node()
>>> step_1 = input_1 + input_2
>>> step_2 = step_1.simple_moving_average(2)

>>> # Get step_1 and step_2 at once
>>> evset_step_1, evset_step_2 = tp.run([step_1, step_2],
...     {input_1: evset_1, input_2: evset_2}
... )

>>> # Equivalent
evset_step_1, evset_step_2 = tp.run(
...     [step_1, step_2],
...     [evset_1, evset_2],
... )

>>> # Also equivalent. EventSets are mapped by their .node(), not by position.
>>> evset_step_1, evset_step_2 = tp.run(
...     [step_1, step_2],
...     [evset_2, evset_1],
... )

Parameters:

Name Type Description Default
query EventSetNodeCollection

EventSetNodes to compute. Supports EventSetNode, dict of EventSetNodes and list of EventSetNodes.

required
input NodeToEventSetMapping

Event sets to be used for the computation. Supports EventSet, list of EventSets, dict of EventSetNodes to EventSets, and dict of EventSetNode names to EventSet. If a single EventSet or list of EventSet, they must be named and will be used as input for the EventSetNodes with the same name. If a dict of EventSetNode names to EventSet, they will be used as input for the EventSetNodes with those names. If a dict of EventSetNodes to event sets, they will be used as input for those EventSetNodes.

required
verbose int

If >0, prints details about the execution on the standard error output. The larger the number, the more information is displayed.

0
check_execution bool

If true, the input and output of the op implementation are validated to check any bug in the library internal code. If false, checks are skipped.

True
force_garbage_collector_interval Optional[float]

If set, triggers the garbage collection every "force_garbage_collector_interval" seconds.

10

Returns:

Type Description
EventSetCollection

An object with the same structure as query containing the results. If query is a dictionary of EventSetNodes, the returned object will be a dictionary of EventSet. If query is a list of EventSetNodes, the returned value will be a list of EventSet with the same order.