Skip to content

Commit 1560a57

Browse files
authored
Merge pull request #7 from diffix/paul-add-galery
added comparison of syndiffix and mostly/ctgan
2 parents 0ffe21e + 113ca35 commit 1560a57

7 files changed

+120
-0
lines changed

_pages/syndiffix-mostlyai-ctgan.md

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
---
2+
layout: page
3+
title: Comparison of SynDiffix, Mostly AI, and CTGAN
4+
permalink: /syndiffix-mostlyai-ctgan
5+
nav: false
6+
---
7+
8+
Compared to other commercial and open-source data synthesis tools, the strength of SynDiffix is its accuracy. Here we compare the accuracy of open-source SynDiffix with the commercial tool [Mostly AI](https://mostly.ai) and the open-source tool CTGAN from [SDV](https://sdv.dev/).
9+
10+
For this comparison, we use the [Czech banking dataset](https://data.world/lpetrocelli/czech-financial-dataset-real-anonymized-transactions). See [here](#how-the-synthetic-data-was-created) for a description of how we generated the synthetic datasets. Note in particular that we used the tools as they were designed to be used: multiple synthetic datasets for SynDiffix, and single datasets for Mostly AI and CTGAN. See
11+
[here](#how-the-comparison-is-and-isnt-fair) for a discussion of how this comparison is and isn't fair.
12+
13+
## Average account balance by type of credit card
14+
15+
892 of the 4500 bank accounts have credit cards. There are three classes of card, 'junior', 'classic', and 'gold'. Here we ask the question, "Does the average account balance differ based on the credit card class?"
16+
17+
The following graphs are percentile boxplots (100th, 75th, 50th, 25th, and 0th percentiles, plus outliers) of the average account balance for each account with a credit card. The two plots show the same data, but grouped by credit card type on the left, and by synthesis method on the right.
18+
19+
{% include image.html src="/assets/img/trans_account_card_clients.avg_balance.card_type.png" alt="SynDiffix usage style" max_width="650px" %}
20+
21+
The SynDiffix synthetic data was produced by first computing the average balance per account from the original data to produce a two-column table consisting of the `avg_balance` and the `card_type`, with one row per account (i.e. not time-series data). This two-column table was then synthesized.
22+
23+
From the original data, we see that indeed gold credit card holders have higher average account balances than classic card holders, which in turn are a little higher than junior cord holders. The data for SynDiffix is very close to the original data, and accurately shows the same trend.
24+
25+
The data for Mostly AI and CTGAN are less accurate. Both show a slightly higher median balance for gold cards, but fail to show a lower balance for junior cards. Both Mostly AI and CTGAN show a much wider range of average balances, include negative average balances where none should exist.
26+
27+
## Distribution of deposit and withdrawal amounts
28+
29+
There are five types of transaction operations. One of them represents deposits (VKLAD), while the other four represent different types of withdrawals (at least as near as we can tell from the Czech translations).
30+
31+
The following graph shows the distribution of deposit and withdrawal amounts for all transactions. Each line is independently sorted from largest to smallest amount. The group of lines on the left are for deposits, which are less numerous.
32+
33+
{% include image.html src="/assets/img/trans_account_card_clients.amount.operation.png" alt="SynDiffix usage style" max_width="400px" %}
34+
35+
The SynDiffix data was created be first creating a two-column table from the original data consisting of transaction `amount` and transaction `type`. This was then synthesized to produce the synthetic dataset.
36+
37+
The important thing to note is that the SynDiffix lines almost perfectly track the original lines. Note that it was necessary to make the Original line thicker so that it is not completely occluded by the SynDiffix line.
38+
39+
For withdrawals, Mostly AI tracks the original data very well until the lower right, where Mostly AI fails to accurately track a series of nearly 200k withdrawals all at around 150 units. Mostly AI also tracks original deposits well, except that there are a small number of small deposits that don't appear in the original data. CTGAN is substantially less accurate overall.
40+
41+
## Total transaction volume per month
42+
43+
The following plot shows the total transaction volume (sum of all transaction amounts) for each month. The two smaller plots zoom in on the two boxed areas.
44+
45+
{% include image.html src="/assets/img/trans_account_card_clients.amount.month.grid.png" alt="SynDiffix usage style" max_width="600px" %}
46+
47+
The SynDiffix data was produced by rounding the transaction date to the month, and then producing a two-column table with `month` and `amount`. This table was then synthesized.
48+
49+
Once again, the SynDiffix line tracks the original data almost perfectly. The zoom-in plots show a very slight difference from the original data.
50+
51+
Mostly AI tracks the original data quite well until the last year, where it diverges substantially. The two zoom-in boxes show that even where Mostly AI tracks well, it is still substantially less accurate than SynDiffix. The CTGAN line manages to show the correct upward trend, but otherwise is quite inaccurate.
52+
53+
## Distribution of maximum balance for all accounts
54+
55+
The following plot gives the distribution of the maximum balance for each account. Each line is sorted independently from highest to lowest maximum balance.
56+
57+
{% include image.html src="/assets/img/trans_account_card_clients.max_balance.png" alt="SynDiffix usage style" max_width="400px" %}
58+
59+
The SynDiffix data was produced by first computing the maximum balance for each account from the original data, creating a one-column table consisting of the maximum balance, with one row per account. This was then synthesized.
60+
61+
The CTGAN line is not shown because it is too far away from the other lines.
62+
63+
SynDiffix tracks the original data almost perfectly, with the exception that a small number of the highest maximum balances are not tracked. SynDiffix suppresses these values because they are outliers that pertain to too few accounts. The Mostly AI line is far less accurate.
64+
65+
## How the synthetic data was created
66+
67+
The Czech banking dataset has seven relational tables. Three of them (loans, orders, and transactions) are time-series tables. The others contain information about clients (banking customers), accounts, and credit cards. To build the synthetic datasets, we joined the client, account, and credit card information with the time-series data to create three extended tables. We then built three synthetic datasets each for Mostly AI and CTGAN from the three extended tables.
68+
69+
Our comparison uses only the extended transactions table. It has the following 21 columns:
70+
71+
| Column | Source table |
72+
| --- | --- |
73+
| trans_id | trans |
74+
| account_id | trans |
75+
| date | trans |
76+
| type | trans |
77+
| operation | trans |
78+
| amount | trans |
79+
| balance | trans |
80+
| k_symbol | trans |
81+
| bank | trans |
82+
| account | trans |
83+
| district_id | account |
84+
| frequency | account |
85+
| account_date | account |
86+
| card_type | card |
87+
| card_issued | card |
88+
| owner_birth | client |
89+
| owner_district_id | client |
90+
| owner_sex | client |
91+
| disponent_birth | client |
92+
| disponent_district_id | client |
93+
| disponent_sex | client |
94+
95+
To make the Mostly AI synthetic dataset, we used the free service available at [mostly.ai](https://mostly.ai). We used the subject-linked option, which captures the time series aspect of the data. We built a synthetic dataset with the same number of accounts (4500) and nearly the same number of rows (1059409) as the original table.
96+
97+
To make the CTGAN synthetic dataset, we used the SDV Python tool. SDV has options for synthesizing both time-series and non-time-series, but unfortunately we were unable to make a time-series dataset because our system did not have enough memory (the system had 1.5TB of memory, but this was not enough). Therefore, we used the non-time-series option to build a synthetic dataset with the same number of rows as the original table (1056320), but with around 10k accounts.
98+
99+
Both the Mostly AI and CTGAN datasets were built using system defaults.
100+
101+
## How the comparison is and isn't fair
102+
103+
The usage style of SynDiffix is different from that of other synthetic data tools. SynDiffix is designed to remain anonymous no matter how many different synthetic datasets are built from the original data. This allows us to build synthetic datasets containing only the columns of interest for the given analysis question. This maximizes accuracy. We built a separate SynDiffix synthetic dataset for each of the comparison examples.
104+
105+
By contrast, we built only a single transactions synthetic dataset each for Mostly AI and CTGAN. All of the comparison examples used these datasets. In principle, we could have also built separate datasets for each comparison example for Mostly AI and CTGAN. Doing so would have resulted in better accuracy (though probably still not as good as SynDiffix, as [this paper](https://arxiv.org/abs/2311.09628) shows). In this sense, the comparison is not apples-to-apples.
106+
107+
Nevertheless, we choose to make the comparison this way for the following reasons:
108+
109+
### Synthetic data products are marketed as one-size-fits-all
110+
111+
Synthetic data products are marketed as one-size-fits-all: the promise is that a single dataset accurately captures the statistical characteristics of the original data. It seems fair to take this marketing at its word, and use it as it is designed to be used.
112+
113+
### The privacy of synthetic data products erodes with multiple syntheses
114+
115+
Unlike SynDiffix, the anonymity of other synthetic data products weakens with each data synthesis. As such, a comparison of multiple SynDiffix synthetic datasets against a single Mostly AI or CTGAN synthetic dataset is fair from a privacy perspective.
116+

_pages/syndiffix.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ nav: true
1414

1515
A complete description of **SynDiffix**, including its operation, performance, and anonymity, can be found on [arXiv](https://arxiv.org/abs/2311.09628). See [github.com/diffix/syndiffix](https://github.com/diffix/syndiffix).
1616

17+
Click [here](/syndiffix-mostlyai-ctgan) for a comparison of SynDiffix with Mostly AI and CTGAN.
18+
19+
<a href="/syndiffix-mostlyai-ctgan"> <img src="/assets/img/compare-link.png"> </a>
20+
1721
Programming with **SynDiffix** can be as easy as:
1822

1923
```py

assets/img/compare-link.png

138 KB
Loading
117 KB
Loading
52.2 KB
Loading
68.3 KB
Loading
47.1 KB
Loading

0 commit comments

Comments
 (0)