Skip to content

Commit

Permalink
Docs on plot aggregation (WIP) (#602)
Browse files Browse the repository at this point in the history
Update docs
  • Loading branch information
elenasamuylova authored May 19, 2023
1 parent 8a45dbd commit feab36f
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 2 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions docs/book/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,11 @@
* [Customization](customization/README.md)
* [Data drift parameters](customization/options-for-statistical-tests.md)
* [Embeddings drift parameters](customization/embeddings-drift-parameters.md)
* [Text descriptors parameters](customization/text-descriptors-parameters.md)
* [Customize JSON output](customization/json-dict-output.md)
* [Plot aggregation in Reports](customization/report-data-aggregation.md)
* [Add a custom drift method](customization/add-custom-drift-method.md)
* [Add a custom metric or test](customization/add-custom-metric-or-test.md)
* [Customize JSON output](customization/json-dict-output.md)
* [Text descriptors parameters](customization/text-descriptors-parameters.md)
* [Options for color schema](customization/options-for-color-schema.md)
* [How-to guides](how-to-guides/README.md)

Expand Down
77 changes: 77 additions & 0 deletions docs/book/customization/report-data-aggregation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
---
description: How to change data aggregation in plots.
---

**Pre-requisites**:
* You know how to generate Reports with default parameters.
* You know how to pass custom parameters for Reports or Metrics.

# Code example

You can refer to an example How-to-notebook:

{% embed url="https://github.com/evidentlyai/evidently/blob/main/examples/how_to_questions/how_to_use_aggregated_data_option.ipynb" %}

# Default

Starting from version 0.3.2, all visualizations in Reports are aggregated by default. This helps reduce the size of the resulting HTML.

For example, you can create a custom Report:

```python
report = Report(metrics=[
RegressionPredictedVsActualScatter(),
RegressionPredictedVsActualPlot()
])
report.run(reference_data=housing_ref, current_data=housing_cur)
report
```

Here is how the Scatter Plot in this Report will look:

![RegressionPredictedVsActualScatter()](../.gitbook/assets/reports/metric_regression_predvsactual_scatter_agg-min.png)

{% hint style="info" %}
**This does not affect Test Suites.** All visualizations in Test Suites are already aggregated.
{% endhint %}

# Non-aggregated plots for Reports

If you want to see non-aggregated plots, you can set the `raw_data` parameter as `True` in the render options.

You can set it on the Report level:

```python
report = Report(
metrics=[
RegressionPredictedVsActualScatter(),
RegressionPredictedVsActualPlot()
],
options={"render": {"raw_data": True}}
)
report.run(reference_data=housing_ref, current_data=housing_cur)
report
```

All plots in the Report will be non-aggregated. Here is how the Scatter Plot in this Report will look:

![RegressionPredictedVsActualScatter()](../.gitbook/assets/reports/metric_regression_predvsactual_scatter_non_agg-min.png)

{% hint style="info" %}
**Consider the data size.** We recommend setting this option for smaller datasets or when you apply sampling. With non-aggregated plots, the HTML will contain all the data on individual data points. They may take significant time to load and be large in size.
{% endhint %}

# Non-aggregated plots for Metrics

If you want to generate non-aggregated plots only for some visualizations, you can pass the option to the chosen Metrics:

```python
report = Report(
metrics=[
RegressionPredictedVsActualScatter(options={"render": {"raw_data": True}}),
RegressionPredictedVsActualPlot()
],
)
report.run(reference_data=housing_ref, current_data=housing_cur)
report
```
6 changes: 6 additions & 0 deletions docs/book/support/migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ In Evidently 0.3.0, the old API was removed from the code base.

# If your code breaks

If you get an error `no module named 'evidently.dashboard'`, you might be running the code that uses old API, with a newer Evidently version.

To make sure your existing code that uses `Dashboards` or `json profiles` works, **fix the Evidently version to 0.2.8 or earlier**.

For example, when installing Evidently, specify:
Expand Down Expand Up @@ -45,12 +47,16 @@ data_drift_report.run(reference_data=ref, current_data=cur)
data_drift_report
```

If you want to keep non-aggregated visualization from the earlier Evidently version, set the [corresponding "agg_data" parmeter to False](../customization/report-data-aggregation.md).

To get what was previously as JSON profile (and has now been improved and re-worked!), simply get the Report output as JSON:

```
data_drift_report.json()
```

If you want to include all the render data in the JSON output, use [parameters to include additional information in JSON](../customization/json-dict-output.md).

You can also get the output as a Python dictionary.

```
Expand Down

0 comments on commit feab36f

Please sign in to comment.