Scan Report#

class giskard.scanner.report.ScanReport(issues, model=None, dataset=None, as_html: bool = True)[source]#

Bases: object

The scan report contains the results of the scan.

Note that this object is not meant to be instantiated directly. Instead, it is returned by the giskard.scan. See Scanner for more details.

Parameters:
  • issues (list) โ€“ A list of Issue objects.

  • model (BaseModel) โ€“ A Giskard model object.

  • dataset (Dataset) โ€“ A Giskard dataset object.

  • as_html (bool) โ€“ Whether to render the report widget as HTML.

generate_test_suite(name=None)[source]#

Automatically generates a test suite from the scan results.

This method provides a way to generate a test suite automatically, based on the issues detected by the scan. The test suite can be used to reproduce the issues and can be uploaded to the Giskard Hub for debugging.

Parameters:

name (Optional[str]) โ€“ The name of the test suite. If not provided, a default name will be used. You can also change the name later by accessing the name attribute of the returned test suite.

Returns:

A test suite containing tests from the scan results.

Return type:

Suite

generate_tests(with_names=False)[source]#

Automatically generates tests from the scan results.

This method provides a way to generate a list of tests automatically, based on the issues detected by the scan. Usually you will want to generate a test suite directly, see generate_test_suite for more details.

Parameters:

with_names (Optional[bool]) โ€“ Whether to return the test names as well. If True, the method will return a list of tuples.

Returns:

A list of Giskard test objects.

Return type:

list

to_avid(filename=None)[source]#

Renders the scan report as an AVID report.

Saves or returns the AVID representation of the scan report.

Parameters:

filename (Optional[str]) โ€“ If provided, the AVID report will be written to the file.

to_dataframe()[source]#

Returns the scan report as a pandas DataFrame.

Returns:

A pandas DataFrame containing the scan report details.

Return type:

pd.DataFrame

to_html(filename=None, embed=False)[source]#

Renders the scan report as HTML.

Saves or returns the HTML representation of the scan report.

Parameters:
  • filename (Optional[str]) โ€“ If provided, the HTML will be written to the file.

  • embed (Optional[bool]) โ€“ Whether to configure the HTML to be embedded in an iframe.

to_markdown(filename=None, template='summary')[source]#

Renders the scan report as markdown.

Saves or returns the markdown representation of the scan report.

Parameters:
  • filename (Optional[str]) โ€“ If provided, the markdown will be written to the file.

  • template (Optional[str]) โ€“ The template to use. Currently, only summary is supported.

to_mlflow(mlflow_client: MlflowClient | None = None, mlflow_run_id: str | None = None, summary: bool = True, model_artifact_path: str = '')[source]#

Logs the scan results to MLflow.

Log the current scan results in an HTML format to the active MLflow run.

to_wandb(run: wandb.wandb_sdk.wandb_run.Run | None = None) None[source]#

Logs the scan results to the WandB run.

Log the current scan results in an HTML format to the active WandB run.

Parameters:

run โ€“ WandB run.