skrub.DataOp.skb.full_report#
- DataOp.skb.full_report(environment=None, open=True, output_dir=None, overwrite=False)[source]#
Generate a full report of the DataOp’s evaluation.
This creates a report showing the computation graph, and for each intermediate computation, some information (the line of code where it was defined, the time it took to run, and more) and a display of the intermediate result (or error).
- Parameters:
- environment
dictorNone(default=None) Bindings for variables and choices contained in the DataOp. If not provided, the variables’
valueand the choices default value are used.- open
bool(default=True) Whether to open the report in a web browser once computed.
- output_dir
strorpathlib.PathorNone(default=None) Directory where to store the report. If
None, a timestamped subdirectory will be created in the skrub data directory.- overwrite
bool(default=False) What to do if the output directory already exists. If
overwrite, replace it, otherwise raise an exception.
- environment
- Returns:
dictThe results of evaluating the DataOp. The keys are
'result','error'and'report_path'. If the execution raised an exception, it is contained in'error'and'result'isNone. Otherwise the result produced by the evaluation is in'result'and'error'isNone. Either way a report is stored at the location indicated by'report_path'.
See also
SkrubLearner.report()Generate a report for a call to any of the methods of the
SkrubLearnersuch astransform(),predict(),predict_proba()etc.
Notes
The learner is run doing a
fit_transform. To get a report for other methods (e.g.predict, seeSkrubLearner.report()). Ifenvironmentis provided, it is used as the bindings for the variables in the DataOp, and otherwise, thevalueattributes of the variables are used.At the moment, this creates a directory on the filesystem containing HTML files. The report can be displayed by visiting the contained
index.htmlin a webbrowser, or passingopen=True(the default) to this method.Examples
>>> # ignore this line: >>> import pytest; pytest.skip('graphviz may not be installed')
>>> import skrub >>> c = skrub.var('a', 1) / skrub.var('b', 2) >>> report = c.skb.full_report(open=False) >>> report['result'] 0.5 >>> report['error'] >>> report['report_path'] PosixPath('.../skrub_data/execution_reports/full_data_op_report_.../index.html')
We pass data:
>>> report = c.skb.full_report({'a': 33, 'b': 11 }, open=False) >>> report['result'] 3.0
And if there was an error:
>>> report = c.skb.full_report({'a': 1, 'b': 0}, open=False) >>> report['result'] >>> report['error'] ZeroDivisionError('division by zero') >>> report['report_path'] PosixPath('.../skrub_data/execution_reports/full_data_op_report_.../index.html')