diff --git a/docs/book/.gitbook/assets/reports/metric_regression_predvsactual_scatter_agg-min.png b/docs/book/.gitbook/assets/reports/metric_regression_predvsactual_scatter_agg-min.png new file mode 100644 index 0000000000..481fbae53d Binary files /dev/null and b/docs/book/.gitbook/assets/reports/metric_regression_predvsactual_scatter_agg-min.png differ diff --git a/docs/book/.gitbook/assets/reports/metric_regression_predvsactual_scatter_non_agg-min.png b/docs/book/.gitbook/assets/reports/metric_regression_predvsactual_scatter_non_agg-min.png new file mode 100644 index 0000000000..97cff96c53 Binary files /dev/null and b/docs/book/.gitbook/assets/reports/metric_regression_predvsactual_scatter_non_agg-min.png differ diff --git a/docs/book/SUMMARY.md b/docs/book/SUMMARY.md index 89b685aa96..106a3fbcaa 100644 --- a/docs/book/SUMMARY.md +++ b/docs/book/SUMMARY.md @@ -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) diff --git a/docs/book/customization/report-data-aggregation.md b/docs/book/customization/report-data-aggregation.md new file mode 100644 index 0000000000..4a0a5d6d28 --- /dev/null +++ b/docs/book/customization/report-data-aggregation.md @@ -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 +``` diff --git a/docs/book/support/migration.md b/docs/book/support/migration.md index a3e979a31c..e3eaecdb7e 100644 --- a/docs/book/support/migration.md +++ b/docs/book/support/migration.md @@ -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: @@ -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. ```