eval_mode#

skrub.eval_mode()[source]#

Return the mode in which the expression is currently being evaluated.

This can be:

  • ‘preview’: when the previews are being eagerly computed when the expression is defined or when we call .skb.eval() without arguments.

  • otherwise, the method we called on the pipeline such as 'predict' or 'fit_transform'.

Examples

>>> import skrub
>>> mode = skrub.eval_mode()
>>> mode.skb.eval()
'preview'
>>> pipeline = mode.skb.get_pipeline()
>>> pipeline.fit_transform({})
'fit_transform'
>>> pipeline.transform({})
'transform'

eval_mode() can be particularly useful to have a different behavior in preview mode in order to speed-up previews during debugging:

>>> n_components = skrub.eval_mode().skb.match({'preview': 2}, default=20)
>>> n_components
<Match <EvalMode>>
Result:
―――――――
2