skrub.Expr.skb.describe_steps#

Expr.skb.describe_steps()[source]#

Get a text representation of the computation graph.

Usually the graphical representation provided by draw_graph or full_report is more useful. This is a fallback for inspecting the computation graph when only text output is available.

Returns:
str

A string representing the different computation steps, one on each line.

Examples

>>> import skrub
>>> a = skrub.var('a')
>>> b = skrub.var('b')
>>> c = a + b
>>> d = c * c
>>> print(d.skb.describe_steps())
VAR 'a'
VAR 'b'
BINOP: add
( VAR 'a' )*
( VAR 'b' )*
( BINOP: add )*
BINOP: mul
* Cached, not recomputed

The above should be read from top to bottom as instructions for a simple stack machine: load the variable ‘a’, load the variable ‘b’, compute the addition leaving the result of (a + b) on the stack, then repeat this operation (but the second time no computation actually runs because the result of evaluating c has been cached in-memory), and finally evaluate the multiplication.