{
  "source_file": "0930",
  "source_platform": "Medium",
  "author": "John Adeojo",
  "title_listed": "Can Synthetic Data Boost Machine Learning Performance?",
  "keywords": "",
  "domain": "机器学习",
  "content_type": "深度技术解析",
  "is_paid_flag": "否",
  "url": "https://towardsdatascience.com/can-synthetic-data-boost-machine-learning-performance-6b4041e75dda/",
  "publish_date": "2023-07-05",
  "corpus_stage": "",
  "notes": "",
  "id": "cf7d5f85853f",
  "collected_at": "2026-10-02T07:09:05",
  "title": "Can Synthetic Data Boost Machine Learning Performance? | Towards Data Science",
  "body_markdown": "![Revisit consent button](../images/body-df29beacd7496220cc94.svg)\nWe value your privacy\nWe use cookies to enhance your browsing experience, serve personalised ads or content, and analyse our traffic. By clicking \"Accept All\", you consent to our use of cookies.\nCustomise Reject All Accept All\nCustomise Consent Preferences ![](../images/body-2159bb67f3de8ad870eb.svg)\nWe use cookies to help you navigate efficiently and perform certain functions. You will find detailed information about all cookies under each consent category below.\nThe cookies that are categorised as \"Necessary\" are stored on your browser as they are essential for enabling the basic functionalities of the site. ... Show more\nNecessaryAlways Active\nNecessary cookies are required to enable the basic features of this site, such as providing secure log-in or adjusting your consent preferences. These cookies do not store any personally identifiable data.\n  * Cookie\nBCTempID\n  * Duration\n10 minutes\n  * Description\nNo description available.\n\n\n  * Cookie\n__cf_bm\n  * Duration\n1 hour\n  * Description\nThis cookie, set by Cloudflare, is used to support Cloudflare Bot Management. \n\n\n  * Cookie\nAWSALBCORS\n  * Duration\n7 days\n  * Description\nAmazon Web Services set this cookie for load balancing.\n\n\n  * Cookie\n_cfuvid\n  * Duration\nsession\n  * Description\nCloudflare sets this cookie to track users across sessions to optimize user experience by maintaining session consistency and providing personalized services\n\n\n  * Cookie\nli_gc\n  * Duration\n6 months\n  * Description\nLinkedin set this cookie for storing visitor's consent regarding using cookies for non-essential purposes.\n\n\n  * Cookie\n__hssrc\n  * Duration\nsession\n  * Description\nThis cookie is set by Hubspot whenever it changes the session cookie. The __hssrc cookie set to 1 indicates that the user has restarted the browser, and if the cookie does not exist, it is assumed to be a new session.\n\n\n  * Cookie\n__hssc\n  * Duration\n1 hour\n  * Description\nHubSpot sets this cookie to keep track of sessions and to determine if HubSpot should increment the session number and timestamps in the __hstc cookie.\n\n\n  * Cookie\nwpEmojiSettingsSupports\n  * Duration\nsession\n  * Description\nWordPress sets this cookie when a user interacts with emojis on a WordPress site. It helps determine if the user's browser can display emojis properly.\n\n\n  * Cookie\nBCSessionID\n  * Duration\n1 year 1 month 4 days\n  * Description\nBlueconic sets this cookie as a unique identifier for the BlueConic profile.\n\n\n  * Cookie\n_octo\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\nlogged_in\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\n__Secure-YEC\n  * Duration\npast\n  * Description\nYouTube sets this cookie to stores the user's video player preferences using embedded YouTube video\n\n\n  * Cookie\n__eoi\n  * Duration\n6 months\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nAWSALBTGCORS\n  * Duration\n7 days\n  * Description\nNo description available.\n\n\n  * Cookie\nlogin-status-p\n  * Duration\npast\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nAWSALBTG\n  * Duration\n7 days\n  * Description\nNo description available.\n\n\n  * Cookie\ncsrf_token\n  * Duration\nsession\n  * Description\nNo description available.\n\n\n  * Cookie\ntoken_v2\n  * Duration\n1 day\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nD\n  * Duration\n1 year\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nPHPSESSID\n  * Duration\nsession\n  * Description\nThis cookie is native to PHP applications. The cookie stores and identifies a user's unique session ID to manage user sessions on the website. The cookie is a session cookie and will be deleted when all the browser windows are closed.\n\n\n  * Cookie\nVISITOR_PRIVACY_METADATA\n  * Duration\n6 months\n  * Description\nYouTube sets this cookie to store the user's cookie consent state for the current domain. \n\n\n  * Cookie\ncookietest\n  * Duration\nsession\n  * Description\nThe cookietest cookie is typically used to determine whether the user's browser accepts cookies, essential for website functionality and user experience.\n\n\n  * Cookie\n__Host-airtable-session\n  * Duration\n1 year\n  * Description\nThis cookie is used to enable us to integrate the services of Airtable.\n\n\n  * Cookie\n__Host-airtable-session.sig\n  * Duration\n1 year\n  * Description\nThis cookie is used to enable us to integrate the services of Airtable.\n\n\n  * Cookie\nm\n  * Duration\n1 year 1 month 4 days\n  * Description\nStripe sets this cookie for fraud prevention purposes. It identifies the device used to access the website, allowing the website to be formatted accordingly.\n\n\n  * Cookie\nBIGipServer*\n  * Duration\nsession\n  * Description\nMarketo sets this cookie to collect information about the user's online activity and build a profile about their interests to provide advertisements relevant to the user. \n\n\n  * Cookie\n__cfruid\n  * Duration\nsession\n  * Description\nCloudflare sets this cookie to identify trusted web traffic.\n\n\n  * Cookie\n_GRECAPTCHA\n  * Duration\n6 months\n  * Description\nGoogle Recaptcha service sets this cookie to identify bots to protect the website against malicious spam attacks.\n\n\n  * Cookie\n__Secure-YNID\n  * Duration\n6 months\n  * Description\nGoogle cookie used to protect user security and prevent fraud, especially during the login process.\n\n\n  * Cookie\ncookieyes-consent\n  * Duration\n1 year\n  * Description\nCookieYes sets this cookie to remember users' consent preferences so that their preferences are respected on subsequent visits to this site. It does not collect or store any personal information about the site visitors.\n\n\nFunctional\nFunctional cookies help perform certain functionalities like sharing the content of the website on social media platforms, collecting feedback, and other third-party features.\n  * Cookie\nlidc\n  * Duration\n1 day\n  * Description\nLinkedIn sets the lidc cookie to facilitate data center selection.\n\n\n  * Cookie\nbrw\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\nbrwConsent\n  * Duration\n5 minutes\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nWMF-Uniq\n  * Duration\n1 year\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nloom_anon_comment\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\nloom_referral_video\n  * Duration\nsession\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nVISITOR_INFO1_LIVE\n  * Duration\n6 months\n  * Description\nA cookie set by YouTube to measure bandwidth that determines whether the user gets the new or old player interface.\n\n\n  * Cookie\nyt-remote-connected-devices\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to store the user's video preferences using embedded YouTube videos.\n\n\n  * Cookie\nytidb::LAST_RESULT_ENTRY_KEY\n  * Duration\nNever Expires\n  * Description\nThe cookie ytidb::LAST_RESULT_ENTRY_KEY is used by YouTube to store the last search result entry that was clicked by the user. This information is used to improve the user experience by providing more relevant search results in the future.\n\n\n  * Cookie\nyt-remote-device-id\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to store the user's video preferences using embedded YouTube videos.\n\n\n  * Cookie\nyt-remote-session-name\n  * Duration\nsession\n  * Description\nThe yt-remote-session-name cookie is used by YouTube to store the user's video player preferences using embedded YouTube video.\n\n\n  * Cookie\nyt-remote-fast-check-period\n  * Duration\nsession\n  * Description\nThe yt-remote-fast-check-period cookie is used by YouTube to store the user's video player preferences for embedded YouTube videos.\n\n\n  * Cookie\nyt-remote-session-app\n  * Duration\nsession\n  * Description\nThe yt-remote-session-app cookie is used by YouTube to store user preferences and information about the interface of the embedded YouTube video player.\n\n\n  * Cookie\nyt-remote-cast-available\n  * Duration\nsession\n  * Description\nThe yt-remote-cast-available cookie is used to store the user's preferences regarding whether casting is available on their YouTube video player.\n\n\n  * Cookie\nyt-remote-cast-installed\n  * Duration\nsession\n  * Description\nThe yt-remote-cast-installed cookie is used to store the user's video player preferences using embedded YouTube video.\n\n\n  * Cookie\ncp_session\n  * Duration\n3 months\n  * Description\nCodepen sets this cookie for Help systems found in the website.\n\n\n  * Cookie\nloid\n  * Duration\n1 year 1 month 4 days\n  * Description\nThis cookie is set by the Reddit. The cookie enables the sharing of content from the website onto the social media platform.\n\n\nAnalytics\nAnalytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics such as the number of visitors, bounce rate, traffic source, etc.\n  * Cookie\n__hstc\n  * Duration\n6 months\n  * Description\nHubspot set this main cookie for tracking visitors. It contains the domain, initial timestamp (first visit), last timestamp (last visit), current timestamp (this visit), and session number (increments for each subsequent session).\n\n\n  * Cookie\nhubspotutk\n  * Duration\n6 months\n  * Description\nHubSpot sets this cookie to keep track of the visitors to the website. This cookie is passed to HubSpot on form submission and used when deduplicating contacts.\n\n\n  * Cookie\n_ga\n  * Duration\n1 year 1 month 4 days\n  * Description\nGoogle Analytics sets this cookie to calculate visitor, session and campaign data and track site usage for the site's analytics report. The cookie stores information anonymously and assigns a randomly generated number to recognise unique visitors.\n\n\n  * Cookie\n_ga_*\n  * Duration\n1 year 1 month 4 days\n  * Description\nGoogle Analytics sets this cookie to store and count page views.\n\n\n  * Cookie\n__Host-psifi.analyticsTrace\n  * Duration\n6 hours\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\n__Host-psifi.analyticsTraceV2\n  * Duration\n6 hours\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\n_gh_sess\n  * Duration\nsession\n  * Description\nGitHub sets this cookie for temporary application and framework state between pages like what step the user is on in a multiple step form.\n\n\n  * Cookie\nYSC\n  * Duration\nsession\n  * Description\nYSC cookie is set by Youtube and is used to track the views of embedded videos on Youtube pages.\n\n\n  * Cookie\najs_anonymous_id\n  * Duration\n1 year\n  * Description\nThis cookie is set by Segment to count the number of people who visit a certain site by tracking if they have visited before.\n\n\n  * Cookie\nvuid\n  * Duration\n1 year 1 month 4 days\n  * Description\nVimeo installs this cookie to collect tracking information by setting a unique ID to embed videos on the website. \n\n\nPerformance\nPerformance cookies are used to understand and analyse the key performance indexes of the website which helps in delivering a better user experience for the visitors.\n  * Cookie\nAWSALB\n  * Duration\n7 days\n  * Description\nAWSALB is an application load balancer cookie set by Amazon Web Services to map the session to the target.\n\n\n  * Cookie\nacq\n  * Duration\npast\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nacq.sig\n  * Duration\npast\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nptc\n  * Duration\n2 years\n  * Description\nNo description available.\n\n\nAdvertisement\nAdvertisement cookies are used to provide visitors with customised advertisements based on the pages you visited previously and to analyse the effectiveness of the ad campaigns.\n  * Cookie\nmuc_ads\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to collect user behaviour and interaction data to optimize the website.\n\n\n  * Cookie\nguest_id_marketing\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to identify and track the website visitor.\n\n\n  * Cookie\nguest_id_ads\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to identify and track the website visitor.\n\n\n  * Cookie\npersonalization_id\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to integrate and share features for social media and also store information about how the user uses the website, for tracking and targeting.\n\n\n  * Cookie\nguest_id\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to identify and track the website visitor. It registers if a user is signed in to the Twitter platform and collects information about ad preferences.\n\n\n  * Cookie\nbcookie\n  * Duration\n1 year\n  * Description\nLinkedIn sets this cookie from LinkedIn share buttons and ad tags to recognize browser IDs.\n\n\n  * Cookie\n__Secure-ROLLOUT_TOKEN\n  * Duration\n6 months\n  * Description\nYouTube sets this cookie to manage feature rollout and experimentation. It helps Google control which new features or interface changes are shown to users as part of testing and staged rollouts, ensuring consistent experience for a given user during an experiment.\n\n\n  * Cookie\nyt.innertube::nextId\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to register a unique ID to store data on what videos from YouTube the user has seen.\n\n\n  * Cookie\nyt.innertube::requests\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to register a unique ID to store data on what videos from YouTube the user has seen.\n\n\n  * Cookie\nsession_tracker\n  * Duration\nsession\n  * Description\nThis cookie is set by the Reddit. This cookie is used to identify trusted web traffic. It also helps in adverstising on the website.\n\n\n  * Cookie\nedgebucket\n  * Duration\nsession\n  * Description\nReddit sets this cookie to save the information about a log-on Reddit user, for the purpose of advertisement recommendations and updating the content.\n\n\n  * Cookie\ndid\n  * Duration\n1 year\n  * Description\nArbor sets this cookie to show targeted ads to site visitors.This cookie expires after 2 months or 1 year.\n\n\nUncategorised\nOther uncategorised cookies are those that are being analysed and have not been classified into a category as yet.\nNo cookies to display.\nReject All Save My Preferences Accept All\nToggle Search[](https://towardsdatascience.com/)Toggle Mobile Navigation\n[](https://towardsdatascience.com/)\nPublish AI, ML & data-science insights to a global community of data professionals.\nSign in[Submit an Article](https://write.insightmediagroup.io)\n[Latest](https://towardsdatascience.com/latest/)[Editor's Picks](https://towardsdatascience.com/tag/editors-pick/)[Newsletter](https://towardsdatascience.com/tag/the-variable/)[ShipAI](https://towardsdatascience.com/shipai/)\n* * *\n[Write For TDS](https://towardsdatascience.com/submissions/)\n[LinkedIn](https://www.linkedin.com/company/towards-data-science/)[X](https://x.com/TDataScience)Toggle Search\n[Artificial Intelligence](https://towardsdatascience.com/category/artificial-intelligence/)\n# Can Synthetic Data Boost Machine Learning Performance?\nInvestigating the Capability of Synthetic Data to Enhance Model Performance on Imbalanced Datasets\n[John Adeojo](https://towardsdatascience.com/author/johnadeojo/)\nJuly 5, 20237 min read\n![Image by Author: Generated with Midjourney](../images/000.png)\nImage by Author: Generated with Midjourney\n## Background - Imbalanced Datasets\nImbalanced classification problems frequently occur in commercial machine learning use cases. You may encounter them in churn prediction, fraud detection, medical diagnosis, or spam detection. In all these scenarios, what we aim to detect belongs to the minority class, which can be highly underrepresented in our data. There are several approaches proposed for enhancing the performance of models on imbalanced datasets:\n  * **Undersampling** : Achieve a more balanced training dataset by randomly undersampling the majority class.\n  * **Oversampling** : Obtain a balanced training dataset by randomly oversampling the minority class.\n  * **Weighted Losses** : Assign weights to the loss function in relation to the minority class.\n  * **Synthetic Data** : Use generative AI to create high-fidelity synthetic data samples of the minority class.\n\n\nIn this article I demonstrate how training a model on synthetic data surpasses the other approaches in enhancing the performance of the classifier.\n* * *\nLearn this step by step with the interactive [AI Engineer](https://roadmap.sh/ai-engineer), [AI and Data Scientist](https://roadmap.sh/ai-data-scientist), [Computer Science](https://roadmap.sh/computer-science) and [Machine Learning](https://roadmap.sh/machine-learning) roadmaps.\n## The Dataset\nThe data is sourced from [Kaggle](https://www.kaggle.com/), consisting of 284,807 credit card transactions, 492 (0.172%) of which are labelled as fraudulent. The data is available for both commercial and non-commercial usage under the Open [Data Commons license](https://opendatacommons.org/licenses/dbcl/1-0/).\nFor interested readers, Kaggle offers more detailed information and basic [descriptive statistics](https://www.kaggle.com/datasets/mlg-ulb/creditcardfraud) about the data.\nFrom this Kaggle dataset, I create two subsets: a training set and a holdout set. The training set comprises 80% of the total data, along with synthetically generated samples when exploring that approach. The holdout set constitutes 20% of the original data, excluding any synthetic samples.\n![Image by Author: Data splitting process](../images/001.png)\nImage by Author: Data splitting process\n* * *\n## The Model\nI use [Ludwig](https://ludwig.ai/latest/), an open-source, declarative framework for building deep learning models due to it's ease of implementation. Models are easily built and trained by declaring them in a yaml file and running a training job through Ludwig's python API. I have written an [article](https://medium.com/towards-data-science/ludwig-a-friendlier-deep-learning-framework-946ee3d3b24) previously that details Ludwig for those who are interested.\nFor each approach, I use the same baseline model, only adjusting specific parameters as necessary. For instance, Ludwig allows for weight and sampling adjustments natively - These are simply adjusted in the yaml file. I have provided links to the model configuration yaml files for each approach for your exploration.\n  * Baseline Model -[ link](https://github.com/john-adeojo/Credit-Card-Fraud-Model-Registry/blob/main/model%20yaml%20files/synthetic_data/baseline_model.yaml)\n  * Weighted losses model - [link](https://github.com/john-adeojo/Credit-Card-Fraud-Model-Registry/blob/main/model%20yaml%20files/synthetic_data/model_weighted_loss.yaml)\n  * Undersampling model - [link](https://github.com/john-adeojo/Credit-Card-Fraud-Model-Registry/blob/main/model%20yaml%20files/synthetic_data/model_undersample.yaml)\n  * Oversampling model - [link](https://github.com/john-adeojo/Credit-Card-Fraud-Model-Registry/blob/main/model%20yaml%20files/synthetic_data/model_oversample.yaml)\n  * Synthetic data - Utilises the same model as the baseline as the classes are balanced.\n\n\n* * *\n## Generating Synthetic Data\nI utilise Synthetic Data Vault (SDV), an open-source library for generating synthetic data samples. With SDV, I generate an additional 284k synthetic fraud samples, thereby achieving equal representation of both classes in the training dataset.\nThe synthetic samples are generated with variational autoencoders adapted for tabular data (TVAE). You can find more details on the theory behind TVAEs in this [paper](https://arxiv.org/pdf/1907.00503.pdf).\n[SDV](https://docs.sdv.dev/sdv/) offers diagnostic statistics, giving an indication of fit quality. You can manually explore the fit quality by comparing variable distributions in the real data versus the generated data as shown in the examples below.\n![Image by Author: Real vs synthetic distribution for variable v1](../images/002.png)\nImage by Author: Real vs synthetic distribution for variable v1\n![Image by Author: Real vs synthetic distribution for variable v10](../images/003.png)\nImage by Author: Real vs synthetic distribution for variable v10\n![Image by Author: Real vs. synthetic distribution for variable amount](../images/004.png)\nImage by Author: Real vs. synthetic distribution for variable amount\n* * *\n## Assessing Performance with Precision Recall Charts\nWe assess the performance of each model by plotting the precision versus recall curves of the models against the holdout dataset.\n### Precision-Recall Curve\nThe Precision-Recall curve, a plot of Precision (on the y-axis) against Recall (on the x-axis) for varying thresholds, is akin to the [ROC curve](<https://developers.google.com/machine-learning/crash-course/classification/roc-and-auc#:~:text=An%20ROC%20curve%20(receiver%20operating,False%20Positive%20Rate>). It serves as a robust diagnostic tool for evaluating model performance in scenarios of significant class imbalance, such as our credit card fraud detection use case, a prime example.\nThe top-right corner of the plot represents the \"ideal\" point - a false positive rate of zero and a true positive rate of one. A skilled model should reach this point or come close to it, implying a larger area under the curve (AUC-PR) can suggest a superior model.\n### No Skill Predictor\nA \"no skill\" predictor is a naïve model that makes predictions randomly. For imbalanced datasets, the no skill line is a horizontal line at a height equivalent to the positive class proportion. This is because if the model randomly predicts the positive class, precision would be equivalent to the positive instances proportion in the dataset.\n* * *\n### Model Performance - Baseline\nThe baseline model is the deep neural network with no sample adjustments, loss function adjustments, or augmented training data. Each approach is compared to the baseline performance, which serves as a performance bench mark.\n![Image by Author: Precision-recall curve for baseline model](../images/005.png)\nImage by Author: Precision-recall curve for baseline model\n### Model Performance - Weighted Losses Approach\nWeighted loss adjusts the loss function based on the ratio of fraudulent to non-fraudulent transactions.\n![Image by Author: Precision-recall curve for loss weighted approach](../images/006.png)\nImage by Author: Precision-recall curve for loss weighted approach\n### Model Performance - Oversampling Approach\nOversampling randomly oversamples the fraudulent transactions until there is equal representation across the classes in the training dataset.\n![Image by Author: Precision-recall curve for oversampling approach](../images/007.png)\nImage by Author: Precision-recall curve for oversampling approach\n### Model Performance - Undersampling Approach\nUndersampling randomly undersamples the non-fraudulent transactions until there is equal representation across classes in the training dataset.\n![Image by Author: Precision-recall curve for undersampling approach](../images/008.png)\nImage by Author: Precision-recall curve for undersampling approach\n### Model Performance - Synthetic Data Approach\nLeverage the TVAEs to produce 284k synthetic, fraudulent samples to gain an equal representation across classes in the training dataset.\n![Image by Author: Precision-recall curve for synthetic data approach](../images/009.png)\nImage by Author: Precision-recall curve for synthetic data approach\n* * *\n## Bootstrapping Holdout Dataset\nTo obtain a robust view of performance on the holdout set, I created fifty bootstrapped holdout sets from the original. Running the models associated with each approach across all sets provides a distribution of performance. We can then determine whether each approach is statistically significantly different from the baseline using the Kolmogorov-Smirnov test.\n**Weighted** : The weighted approach marginally underperformed across recall and AUC relative to the baseline. In addition to this, the variance across each performance metric appears quite high relative to the other approaches.\n![Image by Author: Model performance metrics over 50 bootstrapped holdout samples. Baseline vs Weighted Loss, KS stats - AUC 0.420 p-value &lt; 0.000, precision 0.260 p-value 0.068, Recall 0.520 p-value &lt; 0.000](../images/010.png)\nImage by Author: Model performance metrics over 50 bootstrapped holdout samples. Baseline vs Weighted Loss, KS stats - AUC 0.420 p-value < 0.000, precision 0.260 p-value 0.068, Recall 0.520 p-value < 0.000\n**Oversampling** : The oversampling approach improves model recall relative to baseline, but results in a drastic deterioration of the precision.\n![Image by Author: Model performance metrics over 50 bootstrapped holdout samples. Baseline vs Oversampling, KS stats - AUC 0.160 p-value 0.549, precision 1.0 p-value &lt; 0.000, Recall 0.9 p-value &lt; 0.000](../images/011.png)\nImage by Author: Model performance metrics over 50 bootstrapped holdout samples. Baseline vs Oversampling, KS stats - AUC 0.160 p-value 0.549, precision 1.0 p-value < 0.000, Recall 0.9 p-value < 0.000\n**Undersampling** : The approach performs worse than baseline across all metrics.\n![Image by Author: Model performance metrics over 50 bootstrapped holdout samples. Baseline vs Oversampling, KS stats - AUC 0.880 p-value &lt; 0.000, precision 0.6 p-value &lt; 0.000, Recall 1.0 p-value &lt; 0.000](../images/012.png)\nImage by Author: Model performance metrics over 50 bootstrapped holdout samples. Baseline vs Oversampling, KS stats - AUC 0.880 p-value < 0.000, precision 0.6 p-value < 0.000, Recall 1.0 p-value < 0.000\n**Synthetic** : The synthetic method uplifts model recall, albeit at the cost of precision. While the impact on precision remains substantial, the synthetic approach provides a more resilient alternative for enhancing model recall with less of a detriment to precision when compared to the oversampling approach. The robustness of the synthetic approach is further evidenced by the uplift in AUC-PR.\n![Image by Author: Model performance metrics over 50 bootstrapped holdout samples. Baseline vs Synthetic, KS stats - AUC 0.620, Precision 0.560, Recall 0.360 all p-values ≤ 0.003](../images/body-6dc85c7b39a079d8ec8e.png)\nImage by Author: Model performance metrics over 50 bootstrapped holdout samples. Baseline vs Synthetic, KS stats - AUC 0.620, Precision 0.560, Recall 0.360 all p-values ≤ 0.003\n* * *\n## Conclusion\nWe've noted that the synthetic data approach can boost model recall relative to the baseline at the expense of precision. Oversampling accomplishes a similar result, but model precision suffers drastically in comparison.\nIn our specific context of credit card fraud detection, false positives are not as costly as false negatives. Therefore, we can afford to compromise on model precision if it results in a significant boost in recall. Enriching our training data with synthetic instances seems to be an effective strategy to enhance recall while mitigating the detrimental effects on precision. This enhancement could notably affect profitability, especially when scaling the model to handle millions of transactions. Ultimately, attributing a exact cost to false positives and negatives will provide us with a clearer understanding of the most commercially viable approach, a topic beyond the scope of this article.\nIt would be fascinating to examine the performance across varying sample sizes of synthetic data, perhaps in conjunction with weighted losses. Similarly, experimenting with diverse oversampling ratios could potentially yield comparable effects to what we have observed with the synthetic approach.\nThe notebook for this project is available in my [GitHub repo](https://github.com/john-adeojo/synthetic_data_credit_cards/blob/main/notebook/Synthetic%20Data%20Experiment.ipynb)\n* * *\n_Follow me on_[ _LinkedIn_](https://www.linkedin.com/in/john-adeojo/)\n_Subscribe to medium to get more insights from me:_\n> [**Join Medium with my referral link - John Adeojo**](https://johnadeojo.medium.com/membership)\n_Should you be interested in integrating AI or data science into your business operations, we invite you to schedule a complimentary initial consultation with us:_\n> [**Book Online | Data-Centric Solutions**](https://www.data-centric-solutions.com/book-online)\n## Register Now to Continue Reading\n### Unlock Towards Data Science with a Free Account\nAll articles on Towards Data Science are available to registered users. Create a free account today to access this article and thousands more.\nRegister for freeSign in to your account\n* * *\n![](../images/body-ead068aa953e7b688a96.png)\nWritten By\n## [John Adeojo](https://towardsdatascience.com/author/johnadeojo/)\n[See all from John Adeojo](https://towardsdatascience.com/author/johnadeojo/)\n[Editor's Picks](https://towardsdatascience.com/tag/editors-pick/)[Artificial Intelligence](https://towardsdatascience.com/tag/artificial-intelligence/)[Data Science](https://towardsdatascience.com/tag/data-science/)[Machine Learning](https://towardsdatascience.com/tag/machine-learning/)[Technology](https://towardsdatascience.com/tag/technology/)\nShare This Article\n  * [](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Ftowardsdatascience.com%2Fcan-synthetic-data-boost-machine-learning-performance-6b4041e75dda%2F&title=Can%20Synthetic%20Data%20Boost%20Machine%20Learning%20Performance%3F)\n  * [](https://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Ftowardsdatascience.com%2Fcan-synthetic-data-boost-machine-learning-performance-6b4041e75dda%2F&title=Can%20Synthetic%20Data%20Boost%20Machine%20Learning%20Performance%3F)\n  * [](https://x.com/share?url=https%3A%2F%2Ftowardsdatascience.com%2Fcan-synthetic-data-boost-machine-learning-performance-6b4041e75dda%2F&text=Can%20Synthetic%20Data%20Boost%20Machine%20Learning%20Performance%3F)\n\n\nTowards Data Science is a community publication. Submit your insights to reach our global audience and earn through the TDS Author Payment Program.\n[Write for TDS](https://towardsdatascience.com/submissions/)\n## Related Articles\n  * [![](../images/013.jpg)](https://towardsdatascience.com/implementing-ml-systems-tutorial-server-side-or-client-side-models-3127960f9244/)\n## [Implementing ML Systems tutorial: Server-side or Client-side models?](https://towardsdatascience.com/implementing-ml-systems-tutorial-server-side-or-client-side-models-3127960f9244/)\n[Artificial Intelligence](https://towardsdatascience.com/category/artificial-intelligence/)\nCoding a small Flask server vs Coding a WebDNN browser model\n[Mostafa Ibrahim](https://towardsdatascience.com/author/mostafaibrahim18/)\nJune 12, 20217 min read\n  * [![](../images/014.jpeg)](https://towardsdatascience.com/preventing-outcome-starvation-73af6324e2d4/)\n## [Preventing Outcome Starvation](https://towardsdatascience.com/preventing-outcome-starvation-73af6324e2d4/)\n[Machine Learning](https://towardsdatascience.com/category/artificial-intelligence/machine-learning/)\nWhy degenerate feedback loops need to be urgently addressed when operating machine learning models\n[Anindya Datta](https://towardsdatascience.com/author/adatta_7075/)\nMarch 21, 20229 min read\n  * [![](../images/015.jpg)](https://towardsdatascience.com/measuring-data-ecosystem-maturity-62f0bf7c7143/)\n## [Measuring Data Ecosystem Maturity](https://towardsdatascience.com/measuring-data-ecosystem-maturity-62f0bf7c7143/)\n[Data Science](https://towardsdatascience.com/category/data-science/)\nIntroduction to a scale reflecting economic value of data.\n[Adam Votava](https://towardsdatascience.com/author/adamvotava/)\nDecember 7, 20215 min read\n  * [![](../images/016.jpeg)](https://towardsdatascience.com/top-3-books-to-kickstart-your-machine-learning-journey-58e8668717f2/)\n## [Top 3 Books to Kickstart Your Machine Learning Journey](https://towardsdatascience.com/top-3-books-to-kickstart-your-machine-learning-journey-58e8668717f2/)\n[Artificial Intelligence](https://towardsdatascience.com/category/artificial-intelligence/)\nWheather you are a data analyst or a programmer\n[Dario Radečić](https://towardsdatascience.com/author/radecicdario/)\nOctober 16, 20204 min read\n  * [![](../images/017.jpg)](https://towardsdatascience.com/contributing-to-open-source-for-beginners-cfe98d0a2689/)\n## [Contributing to open source for beginners](https://towardsdatascience.com/contributing-to-open-source-for-beginners-cfe98d0a2689/)\n[Data Science](https://towardsdatascience.com/category/data-science/)\nOr how I went from barely knowing how to use GitHub to 4 accepted pull requests in just a few weeks\n[Maria Ilie](https://towardsdatascience.com/author/maria.alex.ilie/)\nNovember 3, 20204 min read\n  * [![](../images/018.jpg)](https://towardsdatascience.com/arabic-topic-classification-on-the-hespress-news-dataset-7adceef12bed/)\n## [Arabic Topic classification On The Hespress News Dataset](https://towardsdatascience.com/arabic-topic-classification-on-the-hespress-news-dataset-7adceef12bed/)\n[Artificial Intelligence](https://towardsdatascience.com/category/artificial-intelligence/)\nHow to classify Arabic Text the right way\n[Tariq Massaoudi](https://towardsdatascience.com/author/tariqmassaoudi/)\nOctober 18, 20206 min read\n  * [![](../images/019.jpeg)](https://towardsdatascience.com/modeling-and-navigating-a-transportation-network-with-memgraph-944f84828007/)\n## [Modeling and Navigating a Transportation Network with Memgraph](https://towardsdatascience.com/modeling-and-navigating-a-transportation-network-with-memgraph-944f84828007/)\n[](https://towardsdatascience.com/can-synthetic-data-boost-machine-learning-performance-6b4041e75dda/)\nIntroduction\n[Barbara Prkacin](https://towardsdatascience.com/author/barbara-prkacin/)\nApril 12, 202111 min read\n  * [![](../images/020.jpeg)](https://towardsdatascience.com/why-is-the-mad-always-smaller-than-the-std-77c7fcee80a4/)\n## [Why is the MAD always smaller than the STD?](https://towardsdatascience.com/why-is-the-mad-always-smaller-than-the-std-77c7fcee80a4/)\n[Programming](https://towardsdatascience.com/category/programming/)\nIntuition, a derivation and Jensen's Inequality The Mean Absolute Deviation (MAD) and Standard Deviation (STD)...\n[Mark Jamison](https://towardsdatascience.com/author/markjamison03/)\nFebruary 17, 20227 min read\n  * [![](../images/021.jpg)](https://towardsdatascience.com/why-and-how-custom-exceptions-lead-to-cleaner-better-code-2382216829fd/)\n## [Why and how custom exceptions lead to cleaner, better code](https://towardsdatascience.com/why-and-how-custom-exceptions-lead-to-cleaner-better-code-2382216829fd/)\n[Programming](https://towardsdatascience.com/category/programming/)\nClean up your code by creating your own custom exceptions\n[Mike Huls](https://towardsdatascience.com/author/mikehuls/)\nNovember 15, 20222 min read\n\n\n  * [YouTube](https://www.youtube.com/c/TowardsDataScience)\n  * [X](https://x.com/TDataScience)\n  * [LinkedIn](https://www.linkedin.com/company/towards-data-science/)\n  * [Threads](https://www.threads.net/@towardsdatascience)\n  * [Bluesky](https://bsky.app/profile/towardsdatascience.com)\n\n\n[](https://towardsdatascience.com/)\nYour home for data science and AI. The world's leading publication for data science, data analytics, data engineering, machine learning, and artificial intelligence professionals.\nSubscribe to Our Newsletter[Write For TDS](https://towardsdatascience.com/submissions/)•[About](https://towardsdatascience.com/about-towards-data-science-d691af11cc2f/)•[Advertise](https://contact.towardsdatascience.com/advertise-with-towards-data-science)•[Privacy Policy](https://towardsdatascience.com/privacy-policy/)•[Terms of Use](https://towardsdatascience.com/website-terms-of-use/)\n© Insight Media Group, LLC 2026•[The New Stack](https://thenewstack.io)•[roadmap.sh](https://roadmap.sh)•[Creator Network](https://insightmediagroup.io/creator-network)\n####  Recommended Articles \nClose\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607686/image?etag=1782161464448&width=500&height=500) How Relevance Models Foreshadowed Transformers for NLP ](https://towardsdatascience.com/how-relevance-models-foreshadowed-transformers-for-nlp/ \"How Relevance Models Foreshadowed Transformers for NLP\")\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607639/image?etag=1781250125848&width=500&height=500) Javascript Fatigue: HTMX Is All You Need to Build ChatGPT — Part 1 ](https://towardsdatascience.com/javascript-fatigue-you-dont-need-js-to-build-chatgpt/ \"Javascript Fatigue: HTMX Is All You Need to Build ChatGPT — Part 1\")\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607930/image?etag=1782124566054&width=500&height=500) The Subset Sum Problem Solved in Linear Time for Dense Enough Inputs ](https://towardsdatascience.com/subset-sum-problem-solved-in-linear-time-for-dense-enough-inputs/ \"The Subset Sum Problem Solved in Linear Time for Dense Enough Inputs\")\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/3660/image?etag=1780176246070&width=500&height=500) Does Your Company Have a Data Strategy? ](https://towardsdatascience.com/does-your-company-have-a-data-strategy-e8944dbec4ae/ \"Does Your Company Have a Data Strategy?\")\n\n\n",
  "metadata": {
    "title": "Can Synthetic Data Boost Machine Learning Performance? | Towards Data Science",
    "description": "Investigating the Capability of Synthetic Data to Enhance Model Performance on Imbalanced Datasets",
    "keywords": null,
    "author": "John Adeojo",
    "og:locale": "en_US",
    "og:type": "article",
    "og:title": "Can Synthetic Data Boost Machine Learning Performance?",
    "og:description": "Investigating the Capability of Synthetic Data to Enhance Model Performance on Imbalanced Datasets",
    "og:url": "https://towardsdatascience.com/can-synthetic-data-boost-machine-learning-performance-6b4041e75dda/",
    "og:site_name": "Towards Data Science",
    "og:image": "https://assets.insightmediagroup.io/media/wp-content/uploads/2023/07/1jdnPFx1xIqJ9FKnqi_cSbg.png",
    "og:image:width": "1024",
    "og:image:height": "1024",
    "og:image:type": "image/png",
    "twitter:card": "summary_large_image",
    "twitter:site": "@TDataScience",
    "twitter:creator": "@TDataScience",
    "twitter:label1": "Written by",
    "twitter:data1": "John Adeojo",
    "twitter:label2": "Est. reading time",
    "twitter:data2": "7 min read",
    "article:published_time": "2023-07-05T14:48:40.000Z",
    "article:modified_time": "2023-07-05T14:48:40.000Z",
    "article:author": "https://towardsdatascience.com/author/johnadeojo/"
  },
  "paywall": {
    "listed_paid": false,
    "detected": false,
    "marker": "",
    "public_only": false,
    "policy": "付费/会员内容只保留页面公开可见部分，不绕过付费墙"
  },
  "crawl": {
    "success": true,
    "status_code": 202,
    "error": ""
  },
  "code_blocks": [],
  "images": [
    {
      "status": "http_404",
      "url": "https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607686/image?etag=1782161464448&width=500&height=500",
      "src": "https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607686/image?etag=1782161464448&width=500&height=500",
      "alt": "",
      "downloaded": false,
      "discovery": "saved_markdown",
      "retried_at": "2026-10-20T17:49:33Z"
    },
    {
      "status": "http_404",
      "url": "https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607639/image?etag=1781250125848&width=500&height=500",
      "src": "https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607639/image?etag=1781250125848&width=500&height=500",
      "alt": "",
      "downloaded": false,
      "discovery": "saved_markdown",
      "retried_at": "2026-10-20T17:49:33Z"
    },
    {
      "status": "http_404",
      "url": "https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607930/image?etag=1782124566054&width=500&height=500",
      "src": "https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607930/image?etag=1782124566054&width=500&height=500",
      "alt": "",
      "downloaded": false,
      "discovery": "saved_markdown",
      "retried_at": "2026-10-20T17:49:33Z"
    },
    {
      "status": "http_404",
      "url": "https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/3660/image?etag=1780176246070&width=500&height=500",
      "src": "https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/3660/image?etag=1780176246070&width=500&height=500",
      "alt": "",
      "downloaded": false,
      "discovery": "saved_markdown",
      "retried_at": "2026-10-20T17:49:34Z"
    }
  ],
  "audio": [],
  "videos": [
    {
      "url": "https://www.youtube.com/c/TowardsDataScience",
      "kind": "channel_reference",
      "status": "reference_only"
    }
  ],
  "links": [
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/latest/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/editors-pick/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/the-variable/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/shipai/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/submissions/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/category/artificial-intelligence/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/author/johnadeojo/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/artificial-intelligence/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/data-science/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/machine-learning/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/technology/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/implementing-ml-systems-tutorial-server-side-or-client-side-models-3127960f9244/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/author/mostafaibrahim18/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/preventing-outcome-starvation-73af6324e2d4/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/category/artificial-intelligence/machine-learning/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/author/adatta_7075/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/measuring-data-ecosystem-maturity-62f0bf7c7143/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/category/data-science/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/author/adamvotava/"
    },
    {
      "type": "external",
      "href": "https://write.insightmediagroup.io"
    },
    {
      "type": "external",
      "href": "https://www.linkedin.com/company/towards-data-science/"
    },
    {
      "type": "external",
      "href": "https://x.com/TDataScience"
    },
    {
      "type": "external",
      "href": "https://roadmap.sh/ai-engineer"
    },
    {
      "type": "external",
      "href": "https://roadmap.sh/ai-data-scientist"
    },
    {
      "type": "external",
      "href": "https://roadmap.sh/computer-science"
    },
    {
      "type": "external",
      "href": "https://roadmap.sh/machine-learning"
    },
    {
      "type": "external",
      "href": "https://www.kaggle.com/"
    },
    {
      "type": "external",
      "href": "https://opendatacommons.org/licenses/dbcl/1-0/"
    },
    {
      "type": "external",
      "href": "https://www.kaggle.com/datasets/mlg-ulb/creditcardfraud"
    },
    {
      "type": "external",
      "href": "https://ludwig.ai/latest/"
    },
    {
      "type": "external",
      "href": "https://medium.com/towards-data-science/ludwig-a-friendlier-deep-learning-framework-946ee3d3b24"
    },
    {
      "type": "external",
      "href": "https://github.com/john-adeojo/Credit-Card-Fraud-Model-Registry/blob/main/model%20yaml%20files/synthetic_data/baseline_model.yaml"
    },
    {
      "type": "external",
      "href": "https://github.com/john-adeojo/Credit-Card-Fraud-Model-Registry/blob/main/model%20yaml%20files/synthetic_data/model_weighted_loss.yaml"
    },
    {
      "type": "external",
      "href": "https://github.com/john-adeojo/Credit-Card-Fraud-Model-Registry/blob/main/model%20yaml%20files/synthetic_data/model_undersample.yaml"
    },
    {
      "type": "external",
      "href": "https://github.com/john-adeojo/Credit-Card-Fraud-Model-Registry/blob/main/model%20yaml%20files/synthetic_data/model_oversample.yaml"
    },
    {
      "type": "external",
      "href": "https://arxiv.org/pdf/1907.00503.pdf"
    },
    {
      "type": "external",
      "href": "https://docs.sdv.dev/sdv/"
    },
    {
      "type": "external",
      "href": "https://developers.google.com/machine-learning/crash-course/classification/roc-and-auc"
    },
    {
      "type": "external",
      "href": "https://github.com/john-adeojo/synthetic_data_credit_cards/blob/main/notebook/Synthetic%20Data%20Experiment.ipynb"
    }
  ],
  "repair_version": 2,
  "repaired_at": "2026-10-20T17:27:03Z",
  "source_url": "https://towardsdatascience.com/can-synthetic-data-boost-machine-learning-performance-6b4041e75dda/",
  "delivery_status": "unverified",
  "discovery_status": "http_403",
  "missing_reason": "源页面未重新核验:http_403；已按保留正文补采图片",
  "repair_error": "",
  "actual_video_files": [
    {
      "local_path": "attachments/cf7d5f85853f/videos/5aC4hruxBR4.f251.webm",
      "bytes": 7260088,
      "valid": false,
      "height": 0,
      "width": null,
      "duration": "492.661000",
      "status": "invalid_or_wrong_resolution"
    },
    {
      "local_path": "attachments/cf7d5f85853f/videos/5aC4hruxBR4.f298.mp4",
      "bytes": 21590071,
      "valid": true,
      "height": 720,
      "width": 1280,
      "duration": "492.650000",
      "status": "ok"
    },
    {
      "local_path": "attachments/cf7d5f85853f/videos/9PMjEOPUTV8.f251.webm",
      "bytes": 44871030,
      "valid": false,
      "height": 0,
      "width": null,
      "duration": "3343.781000",
      "status": "invalid_or_wrong_resolution"
    },
    {
      "local_path": "attachments/cf7d5f85853f/videos/9PMjEOPUTV8.f299.mp4",
      "bytes": 558574353,
      "valid": true,
      "height": 1080,
      "width": 1920,
      "duration": "3343.750000",
      "status": "ok"
    },
    {
      "local_path": "attachments/cf7d5f85853f/videos/BaV698rqTVE.f251.webm",
      "bytes": 3215355,
      "valid": false,
      "height": 0,
      "width": null,
      "duration": "241.581000",
      "status": "invalid_or_wrong_resolution"
    },
    {
      "local_path": "attachments/cf7d5f85853f/videos/BaV698rqTVE.f399.mp4",
      "bytes": 6200916,
      "valid": true,
      "height": 1080,
      "width": 1888,
      "duration": "241.533333",
      "status": "ok"
    },
    {
      "local_path": "attachments/cf7d5f85853f/videos/DDG7AZo-t0M.f251.webm",
      "bytes": 8717799,
      "valid": false,
      "height": 0,
      "width": null,
      "duration": "693.981000",
      "status": "invalid_or_wrong_resolution"
    },
    {
      "local_path": "attachments/cf7d5f85853f/videos/DDG7AZo-t0M.f399.mp4",
      "bytes": 18251759,
      "valid": true,
      "height": 1080,
      "width": 1662,
      "duration": "693.966667",
      "status": "ok"
    },
    {
      "local_path": "attachments/cf7d5f85853f/videos/J76h5loFn1I.f137.mp4",
      "bytes": 325979873,
      "valid": true,
      "height": 1080,
      "width": 1920,
      "duration": "2942.733333",
      "status": "ok"
    },
    {
      "local_path": "attachments/cf7d5f85853f/videos/J76h5loFn1I.f251.webm",
      "bytes": 39403360,
      "valid": false,
      "height": 0,
      "width": null,
      "duration": "2942.721000",
      "status": "invalid_or_wrong_resolution"
    },
    {
      "local_path": "attachments/cf7d5f85853f/videos/ckI21wSyhSY.f137.mp4",
      "bytes": 369085344,
      "valid": true,
      "height": 1080,
      "width": 1920,
      "duration": "3107.566667",
      "status": "ok"
    },
    {
      "local_path": "attachments/cf7d5f85853f/videos/ckI21wSyhSY.f251.webm",
      "bytes": 48981464,
      "valid": false,
      "height": 0,
      "width": null,
      "duration": "3107.581000",
      "status": "invalid_or_wrong_resolution"
    },
    {
      "local_path": "attachments/cf7d5f85853f/videos/dYSw-SV_fsI.f137.mp4",
      "bytes": 510118997,
      "valid": true,
      "height": 1080,
      "width": 1920,
      "duration": "3502.466667",
      "status": "ok"
    },
    {
      "local_path": "attachments/cf7d5f85853f/videos/dYSw-SV_fsI.f251.webm",
      "bytes": 50508020,
      "valid": false,
      "height": 0,
      "width": null,
      "duration": "3502.501000",
      "status": "invalid_or_wrong_resolution"
    },
    {
      "local_path": "attachments/cf7d5f85853f/videos/dw5Vff_fjoc.f251.webm",
      "bytes": 12502314,
      "valid": false,
      "height": 0,
      "width": null,
      "duration": "803.981000",
      "status": "invalid_or_wrong_resolution"
    },
    {
      "local_path": "attachments/cf7d5f85853f/videos/dw5Vff_fjoc.f399.mp4",
      "bytes": 33276990,
      "valid": true,
      "height": 1080,
      "width": 1920,
      "duration": "803.966667",
      "status": "ok"
    },
    {
      "local_path": "attachments/cf7d5f85853f/videos/r41UzkiR8Hw.f251.webm",
      "bytes": 38694049,
      "valid": false,
      "height": 0,
      "width": null,
      "duration": "2899.101000",
      "status": "invalid_or_wrong_resolution"
    },
    {
      "local_path": "attachments/cf7d5f85853f/videos/r41UzkiR8Hw.f299.mp4",
      "bytes": 465524987,
      "valid": true,
      "height": 1080,
      "width": 1920,
      "duration": "2899.100000",
      "status": "ok"
    },
    {
      "local_path": "attachments/cf7d5f85853f/videos/wE7MG20VT8g.f251.webm",
      "bytes": 34123989,
      "valid": false,
      "height": 0,
      "width": null,
      "duration": "2494.421000",
      "status": "invalid_or_wrong_resolution"
    },
    {
      "local_path": "attachments/cf7d5f85853f/videos/wE7MG20VT8g.f299.mp4",
      "bytes": 405392900,
      "valid": true,
      "height": 1080,
      "width": 1920,
      "duration": "2494.400000",
      "status": "ok"
    },
    {
      "local_path": "attachments/cf7d5f85853f/videos/zQ84HXl_kDc.f251.webm",
      "bytes": 43526388,
      "valid": false,
      "height": 0,
      "width": null,
      "duration": "3081.881000",
      "status": "invalid_or_wrong_resolution"
    },
    {
      "local_path": "attachments/cf7d5f85853f/videos/zQ84HXl_kDc.f299.mp4",
      "bytes": 1084902539,
      "valid": true,
      "height": 1080,
      "width": 1920,
      "duration": "3081.866667",
      "status": "ok"
    }
  ],
  "expected_saved_body_images": 4,
  "image_discovery": "saved_markdown",
  "source_body_markdown": "![Revisit consent button](https://cdn-cookieyes.com/assets/images/revisit.svg)\nWe value your privacy\nWe use cookies to enhance your browsing experience, serve personalised ads or content, and analyse our traffic. By clicking \"Accept All\", you consent to our use of cookies.\nCustomise Reject All Accept All\nCustomise Consent Preferences ![](https://cdn-cookieyes.com/assets/images/close.svg)\nWe use cookies to help you navigate efficiently and perform certain functions. You will find detailed information about all cookies under each consent category below.\nThe cookies that are categorised as \"Necessary\" are stored on your browser as they are essential for enabling the basic functionalities of the site. ... Show more\nNecessaryAlways Active\nNecessary cookies are required to enable the basic features of this site, such as providing secure log-in or adjusting your consent preferences. These cookies do not store any personally identifiable data.\n  * Cookie\nBCTempID\n  * Duration\n10 minutes\n  * Description\nNo description available.\n\n\n  * Cookie\n__cf_bm\n  * Duration\n1 hour\n  * Description\nThis cookie, set by Cloudflare, is used to support Cloudflare Bot Management. \n\n\n  * Cookie\nAWSALBCORS\n  * Duration\n7 days\n  * Description\nAmazon Web Services set this cookie for load balancing.\n\n\n  * Cookie\n_cfuvid\n  * Duration\nsession\n  * Description\nCloudflare sets this cookie to track users across sessions to optimize user experience by maintaining session consistency and providing personalized services\n\n\n  * Cookie\nli_gc\n  * Duration\n6 months\n  * Description\nLinkedin set this cookie for storing visitor's consent regarding using cookies for non-essential purposes.\n\n\n  * Cookie\n__hssrc\n  * Duration\nsession\n  * Description\nThis cookie is set by Hubspot whenever it changes the session cookie. The __hssrc cookie set to 1 indicates that the user has restarted the browser, and if the cookie does not exist, it is assumed to be a new session.\n\n\n  * Cookie\n__hssc\n  * Duration\n1 hour\n  * Description\nHubSpot sets this cookie to keep track of sessions and to determine if HubSpot should increment the session number and timestamps in the __hstc cookie.\n\n\n  * Cookie\nwpEmojiSettingsSupports\n  * Duration\nsession\n  * Description\nWordPress sets this cookie when a user interacts with emojis on a WordPress site. It helps determine if the user's browser can display emojis properly.\n\n\n  * Cookie\nBCSessionID\n  * Duration\n1 year 1 month 4 days\n  * Description\nBlueconic sets this cookie as a unique identifier for the BlueConic profile.\n\n\n  * Cookie\n_octo\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\nlogged_in\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\n__Secure-YEC\n  * Duration\npast\n  * Description\nYouTube sets this cookie to stores the user's video player preferences using embedded YouTube video\n\n\n  * Cookie\n__eoi\n  * Duration\n6 months\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nAWSALBTGCORS\n  * Duration\n7 days\n  * Description\nNo description available.\n\n\n  * Cookie\nlogin-status-p\n  * Duration\npast\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nAWSALBTG\n  * Duration\n7 days\n  * Description\nNo description available.\n\n\n  * Cookie\ncsrf_token\n  * Duration\nsession\n  * Description\nNo description available.\n\n\n  * Cookie\ntoken_v2\n  * Duration\n1 day\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nD\n  * Duration\n1 year\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nPHPSESSID\n  * Duration\nsession\n  * Description\nThis cookie is native to PHP applications. The cookie stores and identifies a user's unique session ID to manage user sessions on the website. The cookie is a session cookie and will be deleted when all the browser windows are closed.\n\n\n  * Cookie\nVISITOR_PRIVACY_METADATA\n  * Duration\n6 months\n  * Description\nYouTube sets this cookie to store the user's cookie consent state for the current domain. \n\n\n  * Cookie\ncookietest\n  * Duration\nsession\n  * Description\nThe cookietest cookie is typically used to determine whether the user's browser accepts cookies, essential for website functionality and user experience.\n\n\n  * Cookie\n__Host-airtable-session\n  * Duration\n1 year\n  * Description\nThis cookie is used to enable us to integrate the services of Airtable.\n\n\n  * Cookie\n__Host-airtable-session.sig\n  * Duration\n1 year\n  * Description\nThis cookie is used to enable us to integrate the services of Airtable.\n\n\n  * Cookie\nm\n  * Duration\n1 year 1 month 4 days\n  * Description\nStripe sets this cookie for fraud prevention purposes. It identifies the device used to access the website, allowing the website to be formatted accordingly.\n\n\n  * Cookie\nBIGipServer*\n  * Duration\nsession\n  * Description\nMarketo sets this cookie to collect information about the user's online activity and build a profile about their interests to provide advertisements relevant to the user. \n\n\n  * Cookie\n__cfruid\n  * Duration\nsession\n  * Description\nCloudflare sets this cookie to identify trusted web traffic.\n\n\n  * Cookie\n_GRECAPTCHA\n  * Duration\n6 months\n  * Description\nGoogle Recaptcha service sets this cookie to identify bots to protect the website against malicious spam attacks.\n\n\n  * Cookie\n__Secure-YNID\n  * Duration\n6 months\n  * Description\nGoogle cookie used to protect user security and prevent fraud, especially during the login process.\n\n\n  * Cookie\ncookieyes-consent\n  * Duration\n1 year\n  * Description\nCookieYes sets this cookie to remember users' consent preferences so that their preferences are respected on subsequent visits to this site. It does not collect or store any personal information about the site visitors.\n\n\nFunctional\nFunctional cookies help perform certain functionalities like sharing the content of the website on social media platforms, collecting feedback, and other third-party features.\n  * Cookie\nlidc\n  * Duration\n1 day\n  * Description\nLinkedIn sets the lidc cookie to facilitate data center selection.\n\n\n  * Cookie\nbrw\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\nbrwConsent\n  * Duration\n5 minutes\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nWMF-Uniq\n  * Duration\n1 year\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nloom_anon_comment\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\nloom_referral_video\n  * Duration\nsession\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nVISITOR_INFO1_LIVE\n  * Duration\n6 months\n  * Description\nA cookie set by YouTube to measure bandwidth that determines whether the user gets the new or old player interface.\n\n\n  * Cookie\nyt-remote-connected-devices\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to store the user's video preferences using embedded YouTube videos.\n\n\n  * Cookie\nytidb::LAST_RESULT_ENTRY_KEY\n  * Duration\nNever Expires\n  * Description\nThe cookie ytidb::LAST_RESULT_ENTRY_KEY is used by YouTube to store the last search result entry that was clicked by the user. This information is used to improve the user experience by providing more relevant search results in the future.\n\n\n  * Cookie\nyt-remote-device-id\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to store the user's video preferences using embedded YouTube videos.\n\n\n  * Cookie\nyt-remote-session-name\n  * Duration\nsession\n  * Description\nThe yt-remote-session-name cookie is used by YouTube to store the user's video player preferences using embedded YouTube video.\n\n\n  * Cookie\nyt-remote-fast-check-period\n  * Duration\nsession\n  * Description\nThe yt-remote-fast-check-period cookie is used by YouTube to store the user's video player preferences for embedded YouTube videos.\n\n\n  * Cookie\nyt-remote-session-app\n  * Duration\nsession\n  * Description\nThe yt-remote-session-app cookie is used by YouTube to store user preferences and information about the interface of the embedded YouTube video player.\n\n\n  * Cookie\nyt-remote-cast-available\n  * Duration\nsession\n  * Description\nThe yt-remote-cast-available cookie is used to store the user's preferences regarding whether casting is available on their YouTube video player.\n\n\n  * Cookie\nyt-remote-cast-installed\n  * Duration\nsession\n  * Description\nThe yt-remote-cast-installed cookie is used to store the user's video player preferences using embedded YouTube video.\n\n\n  * Cookie\ncp_session\n  * Duration\n3 months\n  * Description\nCodepen sets this cookie for Help systems found in the website.\n\n\n  * Cookie\nloid\n  * Duration\n1 year 1 month 4 days\n  * Description\nThis cookie is set by the Reddit. The cookie enables the sharing of content from the website onto the social media platform.\n\n\nAnalytics\nAnalytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics such as the number of visitors, bounce rate, traffic source, etc.\n  * Cookie\n__hstc\n  * Duration\n6 months\n  * Description\nHubspot set this main cookie for tracking visitors. It contains the domain, initial timestamp (first visit), last timestamp (last visit), current timestamp (this visit), and session number (increments for each subsequent session).\n\n\n  * Cookie\nhubspotutk\n  * Duration\n6 months\n  * Description\nHubSpot sets this cookie to keep track of the visitors to the website. This cookie is passed to HubSpot on form submission and used when deduplicating contacts.\n\n\n  * Cookie\n_ga\n  * Duration\n1 year 1 month 4 days\n  * Description\nGoogle Analytics sets this cookie to calculate visitor, session and campaign data and track site usage for the site's analytics report. The cookie stores information anonymously and assigns a randomly generated number to recognise unique visitors.\n\n\n  * Cookie\n_ga_*\n  * Duration\n1 year 1 month 4 days\n  * Description\nGoogle Analytics sets this cookie to store and count page views.\n\n\n  * Cookie\n__Host-psifi.analyticsTrace\n  * Duration\n6 hours\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\n__Host-psifi.analyticsTraceV2\n  * Duration\n6 hours\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\n_gh_sess\n  * Duration\nsession\n  * Description\nGitHub sets this cookie for temporary application and framework state between pages like what step the user is on in a multiple step form.\n\n\n  * Cookie\nYSC\n  * Duration\nsession\n  * Description\nYSC cookie is set by Youtube and is used to track the views of embedded videos on Youtube pages.\n\n\n  * Cookie\najs_anonymous_id\n  * Duration\n1 year\n  * Description\nThis cookie is set by Segment to count the number of people who visit a certain site by tracking if they have visited before.\n\n\n  * Cookie\nvuid\n  * Duration\n1 year 1 month 4 days\n  * Description\nVimeo installs this cookie to collect tracking information by setting a unique ID to embed videos on the website. \n\n\nPerformance\nPerformance cookies are used to understand and analyse the key performance indexes of the website which helps in delivering a better user experience for the visitors.\n  * Cookie\nAWSALB\n  * Duration\n7 days\n  * Description\nAWSALB is an application load balancer cookie set by Amazon Web Services to map the session to the target.\n\n\n  * Cookie\nacq\n  * Duration\npast\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nacq.sig\n  * Duration\npast\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nptc\n  * Duration\n2 years\n  * Description\nNo description available.\n\n\nAdvertisement\nAdvertisement cookies are used to provide visitors with customised advertisements based on the pages you visited previously and to analyse the effectiveness of the ad campaigns.\n  * Cookie\nmuc_ads\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to collect user behaviour and interaction data to optimize the website.\n\n\n  * Cookie\nguest_id_marketing\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to identify and track the website visitor.\n\n\n  * Cookie\nguest_id_ads\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to identify and track the website visitor.\n\n\n  * Cookie\npersonalization_id\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to integrate and share features for social media and also store information about how the user uses the website, for tracking and targeting.\n\n\n  * Cookie\nguest_id\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to identify and track the website visitor. It registers if a user is signed in to the Twitter platform and collects information about ad preferences.\n\n\n  * Cookie\nbcookie\n  * Duration\n1 year\n  * Description\nLinkedIn sets this cookie from LinkedIn share buttons and ad tags to recognize browser IDs.\n\n\n  * Cookie\n__Secure-ROLLOUT_TOKEN\n  * Duration\n6 months\n  * Description\nYouTube sets this cookie to manage feature rollout and experimentation. It helps Google control which new features or interface changes are shown to users as part of testing and staged rollouts, ensuring consistent experience for a given user during an experiment.\n\n\n  * Cookie\nyt.innertube::nextId\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to register a unique ID to store data on what videos from YouTube the user has seen.\n\n\n  * Cookie\nyt.innertube::requests\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to register a unique ID to store data on what videos from YouTube the user has seen.\n\n\n  * Cookie\nsession_tracker\n  * Duration\nsession\n  * Description\nThis cookie is set by the Reddit. This cookie is used to identify trusted web traffic. It also helps in adverstising on the website.\n\n\n  * Cookie\nedgebucket\n  * Duration\nsession\n  * Description\nReddit sets this cookie to save the information about a log-on Reddit user, for the purpose of advertisement recommendations and updating the content.\n\n\n  * Cookie\ndid\n  * Duration\n1 year\n  * Description\nArbor sets this cookie to show targeted ads to site visitors.This cookie expires after 2 months or 1 year.\n\n\nUncategorised\nOther uncategorised cookies are those that are being analysed and have not been classified into a category as yet.\nNo cookies to display.\nReject All Save My Preferences Accept All\nToggle Search[](https://towardsdatascience.com/)Toggle Mobile Navigation\n[](https://towardsdatascience.com/)\nPublish AI, ML & data-science insights to a global community of data professionals.\nSign in[Submit an Article](https://write.insightmediagroup.io)\n[Latest](https://towardsdatascience.com/latest/)[Editor's Picks](https://towardsdatascience.com/tag/editors-pick/)[Newsletter](https://towardsdatascience.com/tag/the-variable/)[ShipAI](https://towardsdatascience.com/shipai/)\n* * *\n[Write For TDS](https://towardsdatascience.com/submissions/)\n[LinkedIn](https://www.linkedin.com/company/towards-data-science/)[X](https://x.com/TDataScience)Toggle Search\n[Artificial Intelligence](https://towardsdatascience.com/category/artificial-intelligence/)\n# Can Synthetic Data Boost Machine Learning Performance?\nInvestigating the Capability of Synthetic Data to Enhance Model Performance on Imbalanced Datasets\n[John Adeojo](https://towardsdatascience.com/author/johnadeojo/)\nJuly 5, 20237 min read\n![Image by Author: Generated with Midjourney](https://assets.insightmediagroup.io/media/wp-content/uploads/2023/07/1jdnPFx1xIqJ9FKnqi_cSbg.png)\nImage by Author: Generated with Midjourney\n## Background - Imbalanced Datasets\nImbalanced classification problems frequently occur in commercial machine learning use cases. You may encounter them in churn prediction, fraud detection, medical diagnosis, or spam detection. In all these scenarios, what we aim to detect belongs to the minority class, which can be highly underrepresented in our data. There are several approaches proposed for enhancing the performance of models on imbalanced datasets:\n  * **Undersampling** : Achieve a more balanced training dataset by randomly undersampling the majority class.\n  * **Oversampling** : Obtain a balanced training dataset by randomly oversampling the minority class.\n  * **Weighted Losses** : Assign weights to the loss function in relation to the minority class.\n  * **Synthetic Data** : Use generative AI to create high-fidelity synthetic data samples of the minority class.\n\n\nIn this article I demonstrate how training a model on synthetic data surpasses the other approaches in enhancing the performance of the classifier.\n* * *\nLearn this step by step with the interactive [AI Engineer](https://roadmap.sh/ai-engineer), [AI and Data Scientist](https://roadmap.sh/ai-data-scientist), [Computer Science](https://roadmap.sh/computer-science) and [Machine Learning](https://roadmap.sh/machine-learning) roadmaps.\n## The Dataset\nThe data is sourced from [Kaggle](https://www.kaggle.com/), consisting of 284,807 credit card transactions, 492 (0.172%) of which are labelled as fraudulent. The data is available for both commercial and non-commercial usage under the Open [Data Commons license](https://opendatacommons.org/licenses/dbcl/1-0/).\nFor interested readers, Kaggle offers more detailed information and basic [descriptive statistics](https://www.kaggle.com/datasets/mlg-ulb/creditcardfraud) about the data.\nFrom this Kaggle dataset, I create two subsets: a training set and a holdout set. The training set comprises 80% of the total data, along with synthetically generated samples when exploring that approach. The holdout set constitutes 20% of the original data, excluding any synthetic samples.\n![Image by Author: Data splitting process](https://assets.insightmediagroup.io/media/wp-content/uploads/2023/07/1Fo-Kzyc_YLquKKuOM246mA.png)\nImage by Author: Data splitting process\n* * *\n## The Model\nI use [Ludwig](https://ludwig.ai/latest/), an open-source, declarative framework for building deep learning models due to it's ease of implementation. Models are easily built and trained by declaring them in a yaml file and running a training job through Ludwig's python API. I have written an [article](https://medium.com/towards-data-science/ludwig-a-friendlier-deep-learning-framework-946ee3d3b24) previously that details Ludwig for those who are interested.\nFor each approach, I use the same baseline model, only adjusting specific parameters as necessary. For instance, Ludwig allows for weight and sampling adjustments natively - These are simply adjusted in the yaml file. I have provided links to the model configuration yaml files for each approach for your exploration.\n  * Baseline Model -[ link](https://github.com/john-adeojo/Credit-Card-Fraud-Model-Registry/blob/main/model%20yaml%20files/synthetic_data/baseline_model.yaml)\n  * Weighted losses model - [link](https://github.com/john-adeojo/Credit-Card-Fraud-Model-Registry/blob/main/model%20yaml%20files/synthetic_data/model_weighted_loss.yaml)\n  * Undersampling model - [link](https://github.com/john-adeojo/Credit-Card-Fraud-Model-Registry/blob/main/model%20yaml%20files/synthetic_data/model_undersample.yaml)\n  * Oversampling model - [link](https://github.com/john-adeojo/Credit-Card-Fraud-Model-Registry/blob/main/model%20yaml%20files/synthetic_data/model_oversample.yaml)\n  * Synthetic data - Utilises the same model as the baseline as the classes are balanced.\n\n\n* * *\n## Generating Synthetic Data\nI utilise Synthetic Data Vault (SDV), an open-source library for generating synthetic data samples. With SDV, I generate an additional 284k synthetic fraud samples, thereby achieving equal representation of both classes in the training dataset.\nThe synthetic samples are generated with variational autoencoders adapted for tabular data (TVAE). You can find more details on the theory behind TVAEs in this [paper](https://arxiv.org/pdf/1907.00503.pdf).\n[SDV](https://docs.sdv.dev/sdv/) offers diagnostic statistics, giving an indication of fit quality. You can manually explore the fit quality by comparing variable distributions in the real data versus the generated data as shown in the examples below.\n![Image by Author: Real vs synthetic distribution for variable v1](https://assets.insightmediagroup.io/media/wp-content/uploads/2023/07/1swDsskSjUFA3eHpz8C9VdA.png)\nImage by Author: Real vs synthetic distribution for variable v1\n![Image by Author: Real vs synthetic distribution for variable v10](https://assets.insightmediagroup.io/media/wp-content/uploads/2023/07/1Y74KjLFexhRLCx3eRewIfg.png)\nImage by Author: Real vs synthetic distribution for variable v10\n![Image by Author: Real vs. synthetic distribution for variable amount](https://assets.insightmediagroup.io/media/wp-content/uploads/2023/07/1LQV2WtId1fo6V61X50vh9A.png)\nImage by Author: Real vs. synthetic distribution for variable amount\n* * *\n## Assessing Performance with Precision Recall Charts\nWe assess the performance of each model by plotting the precision versus recall curves of the models against the holdout dataset.\n### Precision-Recall Curve\nThe Precision-Recall curve, a plot of Precision (on the y-axis) against Recall (on the x-axis) for varying thresholds, is akin to the [ROC curve](<https://developers.google.com/machine-learning/crash-course/classification/roc-and-auc#:~:text=An%20ROC%20curve%20(receiver%20operating,False%20Positive%20Rate>). It serves as a robust diagnostic tool for evaluating model performance in scenarios of significant class imbalance, such as our credit card fraud detection use case, a prime example.\nThe top-right corner of the plot represents the \"ideal\" point - a false positive rate of zero and a true positive rate of one. A skilled model should reach this point or come close to it, implying a larger area under the curve (AUC-PR) can suggest a superior model.\n### No Skill Predictor\nA \"no skill\" predictor is a naïve model that makes predictions randomly. For imbalanced datasets, the no skill line is a horizontal line at a height equivalent to the positive class proportion. This is because if the model randomly predicts the positive class, precision would be equivalent to the positive instances proportion in the dataset.\n* * *\n### Model Performance - Baseline\nThe baseline model is the deep neural network with no sample adjustments, loss function adjustments, or augmented training data. Each approach is compared to the baseline performance, which serves as a performance bench mark.\n![Image by Author: Precision-recall curve for baseline model](https://assets.insightmediagroup.io/media/wp-content/uploads/2023/07/13PTntSkdH1T95DSZEMkcGQ.png)\nImage by Author: Precision-recall curve for baseline model\n### Model Performance - Weighted Losses Approach\nWeighted loss adjusts the loss function based on the ratio of fraudulent to non-fraudulent transactions.\n![Image by Author: Precision-recall curve for loss weighted approach](https://assets.insightmediagroup.io/media/wp-content/uploads/2023/07/1gSYG_dvgFbKAv5IvEynWAw.png)\nImage by Author: Precision-recall curve for loss weighted approach\n### Model Performance - Oversampling Approach\nOversampling randomly oversamples the fraudulent transactions until there is equal representation across the classes in the training dataset.\n![Image by Author: Precision-recall curve for oversampling approach](https://assets.insightmediagroup.io/media/wp-content/uploads/2023/07/1wM6rT1oPTXcVoH4suDTPSA.png)\nImage by Author: Precision-recall curve for oversampling approach\n### Model Performance - Undersampling Approach\nUndersampling randomly undersamples the non-fraudulent transactions until there is equal representation across classes in the training dataset.\n![Image by Author: Precision-recall curve for undersampling approach](https://assets.insightmediagroup.io/media/wp-content/uploads/2023/07/1u7lveiSWhf7DnrKjhwXp0A.png)\nImage by Author: Precision-recall curve for undersampling approach\n### Model Performance - Synthetic Data Approach\nLeverage the TVAEs to produce 284k synthetic, fraudulent samples to gain an equal representation across classes in the training dataset.\n![Image by Author: Precision-recall curve for synthetic data approach](https://assets.insightmediagroup.io/media/wp-content/uploads/2023/07/1TCrwc7rTnatMAOA2tOrtpQ.png)\nImage by Author: Precision-recall curve for synthetic data approach\n* * *\n## Bootstrapping Holdout Dataset\nTo obtain a robust view of performance on the holdout set, I created fifty bootstrapped holdout sets from the original. Running the models associated with each approach across all sets provides a distribution of performance. We can then determine whether each approach is statistically significantly different from the baseline using the Kolmogorov-Smirnov test.\n**Weighted** : The weighted approach marginally underperformed across recall and AUC relative to the baseline. In addition to this, the variance across each performance metric appears quite high relative to the other approaches.\n![Image by Author: Model performance metrics over 50 bootstrapped holdout samples. Baseline vs Weighted Loss, KS stats - AUC 0.420 p-value &lt; 0.000, precision 0.260 p-value 0.068, Recall 0.520 p-value &lt; 0.000](https://assets.insightmediagroup.io/media/wp-content/uploads/2023/07/10kaMqkPP5T85yON_H4UBSw.png)\nImage by Author: Model performance metrics over 50 bootstrapped holdout samples. Baseline vs Weighted Loss, KS stats - AUC 0.420 p-value < 0.000, precision 0.260 p-value 0.068, Recall 0.520 p-value < 0.000\n**Oversampling** : The oversampling approach improves model recall relative to baseline, but results in a drastic deterioration of the precision.\n![Image by Author: Model performance metrics over 50 bootstrapped holdout samples. Baseline vs Oversampling, KS stats - AUC 0.160 p-value 0.549, precision 1.0 p-value &lt; 0.000, Recall 0.9 p-value &lt; 0.000](https://assets.insightmediagroup.io/media/wp-content/uploads/2023/07/1YlTPqZGUsJdUkslbdk8IpA.png)\nImage by Author: Model performance metrics over 50 bootstrapped holdout samples. Baseline vs Oversampling, KS stats - AUC 0.160 p-value 0.549, precision 1.0 p-value < 0.000, Recall 0.9 p-value < 0.000\n**Undersampling** : The approach performs worse than baseline across all metrics.\n![Image by Author: Model performance metrics over 50 bootstrapped holdout samples. Baseline vs Oversampling, KS stats - AUC 0.880 p-value &lt; 0.000, precision 0.6 p-value &lt; 0.000, Recall 1.0 p-value &lt; 0.000](https://assets.insightmediagroup.io/media/wp-content/uploads/2023/07/1fljL8kPB-VlpdyTWZKC9nQ.png)\nImage by Author: Model performance metrics over 50 bootstrapped holdout samples. Baseline vs Oversampling, KS stats - AUC 0.880 p-value < 0.000, precision 0.6 p-value < 0.000, Recall 1.0 p-value < 0.000\n**Synthetic** : The synthetic method uplifts model recall, albeit at the cost of precision. While the impact on precision remains substantial, the synthetic approach provides a more resilient alternative for enhancing model recall with less of a detriment to precision when compared to the oversampling approach. The robustness of the synthetic approach is further evidenced by the uplift in AUC-PR.\n![Image by Author: Model performance metrics over 50 bootstrapped holdout samples. Baseline vs Synthetic, KS stats - AUC 0.620, Precision 0.560, Recall 0.360 all p-values ≤ 0.003](https://assets.insightmediagroup.io/media/wp-content/uploads/2023/07/1b_36oj9tN1Iya_BV_IeDfw.png)\nImage by Author: Model performance metrics over 50 bootstrapped holdout samples. Baseline vs Synthetic, KS stats - AUC 0.620, Precision 0.560, Recall 0.360 all p-values ≤ 0.003\n* * *\n## Conclusion\nWe've noted that the synthetic data approach can boost model recall relative to the baseline at the expense of precision. Oversampling accomplishes a similar result, but model precision suffers drastically in comparison.\nIn our specific context of credit card fraud detection, false positives are not as costly as false negatives. Therefore, we can afford to compromise on model precision if it results in a significant boost in recall. Enriching our training data with synthetic instances seems to be an effective strategy to enhance recall while mitigating the detrimental effects on precision. This enhancement could notably affect profitability, especially when scaling the model to handle millions of transactions. Ultimately, attributing a exact cost to false positives and negatives will provide us with a clearer understanding of the most commercially viable approach, a topic beyond the scope of this article.\nIt would be fascinating to examine the performance across varying sample sizes of synthetic data, perhaps in conjunction with weighted losses. Similarly, experimenting with diverse oversampling ratios could potentially yield comparable effects to what we have observed with the synthetic approach.\nThe notebook for this project is available in my [GitHub repo](https://github.com/john-adeojo/synthetic_data_credit_cards/blob/main/notebook/Synthetic%20Data%20Experiment.ipynb)\n* * *\n_Follow me on_[ _LinkedIn_](https://www.linkedin.com/in/john-adeojo/)\n_Subscribe to medium to get more insights from me:_\n> [**Join Medium with my referral link - John Adeojo**](https://johnadeojo.medium.com/membership)\n_Should you be interested in integrating AI or data science into your business operations, we invite you to schedule a complimentary initial consultation with us:_\n> [**Book Online | Data-Centric Solutions**](https://www.data-centric-solutions.com/book-online)\n## Register Now to Continue Reading\n### Unlock Towards Data Science with a Free Account\nAll articles on Towards Data Science are available to registered users. Create a free account today to access this article and thousands more.\nRegister for freeSign in to your account\n* * *\n![](https://assets.insightmediagroup.io/media/1787657091747_phu3q1.png)\nWritten By\n## [John Adeojo](https://towardsdatascience.com/author/johnadeojo/)\n[See all from John Adeojo](https://towardsdatascience.com/author/johnadeojo/)\n[Editor's Picks](https://towardsdatascience.com/tag/editors-pick/)[Artificial Intelligence](https://towardsdatascience.com/tag/artificial-intelligence/)[Data Science](https://towardsdatascience.com/tag/data-science/)[Machine Learning](https://towardsdatascience.com/tag/machine-learning/)[Technology](https://towardsdatascience.com/tag/technology/)\nShare This Article\n  * [](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Ftowardsdatascience.com%2Fcan-synthetic-data-boost-machine-learning-performance-6b4041e75dda%2F&title=Can%20Synthetic%20Data%20Boost%20Machine%20Learning%20Performance%3F)\n  * [](https://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Ftowardsdatascience.com%2Fcan-synthetic-data-boost-machine-learning-performance-6b4041e75dda%2F&title=Can%20Synthetic%20Data%20Boost%20Machine%20Learning%20Performance%3F)\n  * [](https://x.com/share?url=https%3A%2F%2Ftowardsdatascience.com%2Fcan-synthetic-data-boost-machine-learning-performance-6b4041e75dda%2F&text=Can%20Synthetic%20Data%20Boost%20Machine%20Learning%20Performance%3F)\n\n\nTowards Data Science is a community publication. Submit your insights to reach our global audience and earn through the TDS Author Payment Program.\n[Write for TDS](https://towardsdatascience.com/submissions/)\n## Related Articles\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2021/06/0AJjmhkx7gX6dZNNn-scaled.jpg)](https://towardsdatascience.com/implementing-ml-systems-tutorial-server-side-or-client-side-models-3127960f9244/)\n## [Implementing ML Systems tutorial: Server-side or Client-side models?](https://towardsdatascience.com/implementing-ml-systems-tutorial-server-side-or-client-side-models-3127960f9244/)\n[Artificial Intelligence](https://towardsdatascience.com/category/artificial-intelligence/)\nCoding a small Flask server vs Coding a WebDNN browser model\n[Mostafa Ibrahim](https://towardsdatascience.com/author/mostafaibrahim18/)\nJune 12, 20217 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2022/03/1dDiW_1g16-32g1IZ5lpsqw.jpeg)](https://towardsdatascience.com/preventing-outcome-starvation-73af6324e2d4/)\n## [Preventing Outcome Starvation](https://towardsdatascience.com/preventing-outcome-starvation-73af6324e2d4/)\n[Machine Learning](https://towardsdatascience.com/category/artificial-intelligence/machine-learning/)\nWhy degenerate feedback loops need to be urgently addressed when operating machine learning models\n[Anindya Datta](https://towardsdatascience.com/author/adatta_7075/)\nMarch 21, 20229 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2021/12/0VJcbc7RC_lNLHyTB-scaled.jpg)](https://towardsdatascience.com/measuring-data-ecosystem-maturity-62f0bf7c7143/)\n## [Measuring Data Ecosystem Maturity](https://towardsdatascience.com/measuring-data-ecosystem-maturity-62f0bf7c7143/)\n[Data Science](https://towardsdatascience.com/category/data-science/)\nIntroduction to a scale reflecting economic value of data.\n[Adam Votava](https://towardsdatascience.com/author/adamvotava/)\nDecember 7, 20215 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2020/10/18Uxrzkqxr-HQzNKRO_7TiA-scaled.jpeg)](https://towardsdatascience.com/top-3-books-to-kickstart-your-machine-learning-journey-58e8668717f2/)\n## [Top 3 Books to Kickstart Your Machine Learning Journey](https://towardsdatascience.com/top-3-books-to-kickstart-your-machine-learning-journey-58e8668717f2/)\n[Artificial Intelligence](https://towardsdatascience.com/category/artificial-intelligence/)\nWheather you are a data analyst or a programmer\n[Dario Radečić](https://towardsdatascience.com/author/radecicdario/)\nOctober 16, 20204 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2020/11/0K9afFezuwiFdHLuC-scaled.jpg)](https://towardsdatascience.com/contributing-to-open-source-for-beginners-cfe98d0a2689/)\n## [Contributing to open source for beginners](https://towardsdatascience.com/contributing-to-open-source-for-beginners-cfe98d0a2689/)\n[Data Science](https://towardsdatascience.com/category/data-science/)\nOr how I went from barely knowing how to use GitHub to 4 accepted pull requests in just a few weeks\n[Maria Ilie](https://towardsdatascience.com/author/maria.alex.ilie/)\nNovember 3, 20204 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2020/10/0-MNlm46aQfTjdCpp-scaled.jpg)](https://towardsdatascience.com/arabic-topic-classification-on-the-hespress-news-dataset-7adceef12bed/)\n## [Arabic Topic classification On The Hespress News Dataset](https://towardsdatascience.com/arabic-topic-classification-on-the-hespress-news-dataset-7adceef12bed/)\n[Artificial Intelligence](https://towardsdatascience.com/category/artificial-intelligence/)\nHow to classify Arabic Text the right way\n[Tariq Massaoudi](https://towardsdatascience.com/author/tariqmassaoudi/)\nOctober 18, 20206 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2021/04/1QTd4IFUNfh49ya4-_LpZ2Q-scaled.jpeg)](https://towardsdatascience.com/modeling-and-navigating-a-transportation-network-with-memgraph-944f84828007/)\n## [Modeling and Navigating a Transportation Network with Memgraph](https://towardsdatascience.com/modeling-and-navigating-a-transportation-network-with-memgraph-944f84828007/)\n[](https://towardsdatascience.com/can-synthetic-data-boost-machine-learning-performance-6b4041e75dda/)\nIntroduction\n[Barbara Prkacin](https://towardsdatascience.com/author/barbara-prkacin/)\nApril 12, 202111 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2022/02/1WAPrPeDoy5_U4ObO_M3tfw-scaled.jpeg)](https://towardsdatascience.com/why-is-the-mad-always-smaller-than-the-std-77c7fcee80a4/)\n## [Why is the MAD always smaller than the STD?](https://towardsdatascience.com/why-is-the-mad-always-smaller-than-the-std-77c7fcee80a4/)\n[Programming](https://towardsdatascience.com/category/programming/)\nIntuition, a derivation and Jensen's Inequality The Mean Absolute Deviation (MAD) and Standard Deviation (STD)...\n[Mark Jamison](https://towardsdatascience.com/author/markjamison03/)\nFebruary 17, 20227 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2022/11/0vgsBobSdABi3Bytj.jpg)](https://towardsdatascience.com/why-and-how-custom-exceptions-lead-to-cleaner-better-code-2382216829fd/)\n## [Why and how custom exceptions lead to cleaner, better code](https://towardsdatascience.com/why-and-how-custom-exceptions-lead-to-cleaner-better-code-2382216829fd/)\n[Programming](https://towardsdatascience.com/category/programming/)\nClean up your code by creating your own custom exceptions\n[Mike Huls](https://towardsdatascience.com/author/mikehuls/)\nNovember 15, 20222 min read\n\n\n  * [YouTube](https://www.youtube.com/c/TowardsDataScience)\n  * [X](https://x.com/TDataScience)\n  * [LinkedIn](https://www.linkedin.com/company/towards-data-science/)\n  * [Threads](https://www.threads.net/@towardsdatascience)\n  * [Bluesky](https://bsky.app/profile/towardsdatascience.com)\n\n\n[](https://towardsdatascience.com/)\nYour home for data science and AI. The world's leading publication for data science, data analytics, data engineering, machine learning, and artificial intelligence professionals.\nSubscribe to Our Newsletter[Write For TDS](https://towardsdatascience.com/submissions/)•[About](https://towardsdatascience.com/about-towards-data-science-d691af11cc2f/)•[Advertise](https://contact.towardsdatascience.com/advertise-with-towards-data-science)•[Privacy Policy](https://towardsdatascience.com/privacy-policy/)•[Terms of Use](https://towardsdatascience.com/website-terms-of-use/)\n© Insight Media Group, LLC 2026•[The New Stack](https://thenewstack.io)•[roadmap.sh](https://roadmap.sh)•[Creator Network](https://insightmediagroup.io/creator-network)\n####  Recommended Articles \nClose\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607686/image?etag=1782161464448&width=500&height=500) How Relevance Models Foreshadowed Transformers for NLP ](https://towardsdatascience.com/how-relevance-models-foreshadowed-transformers-for-nlp/ \"How Relevance Models Foreshadowed Transformers for NLP\")\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607639/image?etag=1781250125848&width=500&height=500) Javascript Fatigue: HTMX Is All You Need to Build ChatGPT — Part 1 ](https://towardsdatascience.com/javascript-fatigue-you-dont-need-js-to-build-chatgpt/ \"Javascript Fatigue: HTMX Is All You Need to Build ChatGPT — Part 1\")\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607930/image?etag=1782124566054&width=500&height=500) The Subset Sum Problem Solved in Linear Time for Dense Enough Inputs ](https://towardsdatascience.com/subset-sum-problem-solved-in-linear-time-for-dense-enough-inputs/ \"The Subset Sum Problem Solved in Linear Time for Dense Enough Inputs\")\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/3660/image?etag=1780176246070&width=500&height=500) Does Your Company Have a Data Strategy? ](https://towardsdatascience.com/does-your-company-have-a-data-strategy-e8944dbec4ae/ \"Does Your Company Have a Data Strategy?\")\n\n\n",
  "body_base_path": "attachments/cf7d5f85853f/pages/",
  "body_markdown_path": "attachments/cf7d5f85853f/pages/archived-body.md",
  "local_html": "attachments/cf7d5f85853f/pages/archived-body.html",
  "body_source": "prior_capture"
}