diff --git a/examples/cookbook/correlations_metrics.ipynb b/examples/cookbook/correlations_metrics.ipynb new file mode 100644 index 0000000000..a74dad69a5 --- /dev/null +++ b/examples/cookbook/correlations_metrics.ipynb @@ -0,0 +1,1002 @@ +{ + "cells": [ + { + "metadata": { + "ExecuteTime": { + "end_time": "2025-09-18T08:23:48.167378Z", + "start_time": "2025-09-18T08:23:45.826755Z" + } + }, + "cell_type": "code", + "source": [ + "import pandas as pd\n", + "\n", + "from evidently import BinaryClassification\n", + "from evidently import DataDefinition\n", + "from evidently import Dataset\n", + "from evidently import Report\n" + ], + "id": "305692d99dda45b7", + "outputs": [], + "execution_count": 1 + }, + { + "metadata": {}, + "cell_type": "markdown", + "source": "## Correlations", + "id": "cd3c1c6e7610f00e" + }, + { + "metadata": { + "ExecuteTime": { + "end_time": "2025-09-18T08:23:48.340286Z", + "start_time": "2025-09-18T08:23:48.181597Z" + } + }, + "cell_type": "code", + "source": [ + "from evidently.metrics import DatasetCorrelations, ColumnCorrelations\n", + "\n", + "correlations_data = pd.DataFrame(\n", + " {\n", + " \"my_target\": [1, 2.5, 3] * 1000,\n", + " \"my_prediction\": [1, 2, 3] * 1000,\n", + " \"feature_1\": [1, 2.2, 3] * 1000,\n", + " \"feature_2\": [13, 0, 100.3] * 1000,\n", + " }\n", + " )\n", + "correlations_dataset = Dataset.from_pandas(\n", + " correlations_data,\n", + " data_definition=DataDefinition(\n", + " classification=[BinaryClassification(target=\"my_target\", prediction_labels=\"my_prediction\")]\n", + " ),\n", + " )\n", + "\n", + "correlations_report = Report(metrics=[\n", + " ColumnCorrelations(column_name=\"my_target\"),\n", + " DatasetCorrelations(),\n", + "])\n", + "correlations_snapshot = correlations_report.run(correlations_dataset)\n", + "correlations_snapshot" + ], + "id": "ff888e6b990d3864", + "outputs": [ + { + "data": { + "text/plain": [ + "" + ], + "text/html": [ + "\n", + " \n", + " \n", + " \n", + "