> For the complete documentation index, see [llms.txt](https://seattle-university.gitbook.io/sdgne/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://seattle-university.gitbook.io/sdgne/evaluation.md).

# Evaluation

To evaluate the quality of synthetically generated data, we use functions from the `Evaluation` class. &#x20;

```python
from sdgne.evaluator.evaluator import Evaluation

evaluator = Evaluation(synthesized_data, minority_column_label, minority_class_label)
```

## Importing Evaluation

```python
from sdgne.evaluator.evaluator import Evaluation
```

## Creating an evaluator

```python
evaluator = Evaluation(synthesized_data, minority_column_label, minority_class_label)
```

{% hint style="info" %}
The synthesized\_data can be created using any Auto Encoder and should have a 'synthesized\_data' column.
{% endhint %}

***

## evaluator.duplicate\_in\_rows()

Calculate the percentage of duplicate rows between the original minority data and the synthetic minority data.

### Returns

The percentage of duplicate rows.

## evaluator.mean\_and\_std()

Calculate the mean and standard deviation for each column in the original and synthetic minority data.

### Returns

A pandas data frame containing the mean difference, mean of original minority data, mean of synthetic minority data, standard deviation of original minority data, and standard deviation of synthetic minority data for each column.

## Kullback-Leibler (KL) divergence

Kullback-Leibler (KL) divergence is a measure of how one probability distribution diverges from a second, expected probability distribution. In simple terms, it quantifies the difference between two probability distributions.

## evaluator.plot\_kde\_density\_graph()

Plots the kernel density estimation (KDE) graphs for each column of the original and synthetic minority data. Also calculates the highlighted area and KL divergence for each column.

<figure><img src="https://4225875709-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FC846Wkz38KIQSdiWS1pv%2Fuploads%2FO2XOuiVXaJEmqjrmbeAx%2Fkl_div_graph.png?alt=media&amp;token=03f11723-d8cf-48d0-bb91-cf267665363c" alt=""><figcaption></figcaption></figure>

### Returns

<table data-header-hidden><thead><tr><th width="221"></th><th width="173"></th><th></th></tr></thead><tbody><tr><td>plt</td><td>matplotlib.pyplot</td><td>Represents the KDE density plots</td></tr><tr><td>column_details</td><td>pd.Dataframe</td><td>Represents a data frame with the area of highlighted area and divergence for each column.</td></tr><tr><td>total_highlighted_area</td><td>float</td><td>Represents the total highlighted area in the plot.</td></tr><tr><td>total_kl_divergence</td><td>float</td><td>Represents total KL divergence.</td></tr><tr><td>average_kl_divergence</td><td>float</td><td>Represents average KL divergence calculated over all columns.</td></tr></tbody></table>

## evaluator.plot\_heat\_maps()

Plots heat maps for the correlation matrices of the original and synthetic minority data.

<figure><img src="https://4225875709-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FC846Wkz38KIQSdiWS1pv%2Fuploads%2FCzAvVz2UbpxxSajx7kUl%2Fheatmap_graph.png?alt=media&amp;token=f7768e5b-c4b8-404d-a6ad-f24a3d1d5a6c" alt=""><figcaption></figcaption></figure>

### Returns

The matplotlib.pyplot object contains the heat maps.
