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, mlflow_run_id: str = 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.