{"id":3479,"date":"2023-08-31T11:12:59","date_gmt":"2023-08-31T11:12:59","guid":{"rendered":"https:\/\/neuraldesigner.com\/learning\/credit-card-fraud\/"},"modified":"2026-02-12T12:50:54","modified_gmt":"2026-02-12T11:50:54","slug":"credit-card-fraud","status":"publish","type":"learning","link":"https:\/\/www.neuraldesigner.com\/learning\/examples\/credit-card-fraud\/","title":{"rendered":"Detect fraud in credit card transactions using machine learning"},"content":{"rendered":"<p>In this example, we develop a machine learning model to detect fraudulent credit card transactions.<\/p>\n<p>Credit card fraud occurs when someone uses a credit card or credit account without authorization.<\/p>\n<p>This activity can occur in various ways: if you lose your credit card or it is stolen, it can be used to make purchases or other payments, either in person or online.<\/p>\n<p>Depending on different variables, this example will classify payments from a credit card as fraudulent or non-fraudulent.<\/p>\n<section>\n<h3>Contents<\/h3>\n<ol>\n<li><a href=\"#ApplicationType\">Application type<\/a>.<\/li>\n<li><a href=\"#DataSet\">Data set<\/a>.<\/li>\n<li><a href=\"#NeuralNetwork\">Neural network<\/a>.<\/li>\n<li><a href=\"#TrainingStrategy\">Training strategy<\/a>.<\/li>\n<li><a href=\"#ModelSelection\">Model selection<\/a>.<\/li>\n<li><a href=\"#TestingAnalysis\">Testing analysis<\/a>.<\/li>\n<li><a href=\"#ModelDeployment\">Model deployment<\/a>.<\/li>\n<li><a href=\"#TutorialVideo\">Tutorial video<\/a>.<\/li>\n<\/ol>\n<p>This example was solved with <a href=\"https:\/\/www.neuraldesigner.com\/\">Neural Designer<\/a>. You can use the <a href=\"https:\/\/www.neuraldesigner.com\/free-trial\">free trial<\/a> to follow this example step by step.<\/p>\n<\/section>\n<section id=\"ApplicationType\">\n<h2>1. Application type<\/h2>\n<p>This is a <a href=\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/neural-networks-applications#Classification\">classification<\/a> project because the predictor variable is binary (fraudulent or not).<\/p>\n<p>The goal is to develop a model that estimates the likelihood of a transaction being fraudulent.<\/p>\n<\/section>\n<section id=\"DataSet\">\n<h2>2. Data set<\/h2>\n<p>The dataset contains the information needed to create our model. We need to configure three things:<\/p>\n<ul>\n<li>Data source.<\/li>\n<li>Variables.<\/li>\n<li>Instances.<\/li>\n<\/ul>\n<p>The data file used for this example is <a href=\"https:\/\/www.neuraldesigner.com\/wp-content\/uploads\/2023\/10\/creditcard-fraud.csv\">creditcard-fraud.csv<\/a>, which contains 11 features for about 3,075 payments.<\/p>\n<h3>Variables<\/h3>\n<p>The data set includes the following <a href=\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/data-set#Variables\">variables<\/a>:<\/p>\n<\/section>\n<h4 data-start=\"940\" data-end=\"965\"><strong data-start=\"944\" data-end=\"965\">Merchant Behavior<\/strong><\/h4>\n<ul data-start=\"966\" data-end=\"1068\">\n<li data-start=\"966\" data-end=\"1068\">\n<p data-start=\"968\" data-end=\"1068\"><strong data-start=\"968\" data-end=\"983\">Merchant ID<\/strong> (<code data-start=\"985\" data-end=\"998\">merchant_id<\/code>): Unique identifier of the merchant where the transaction occurred.<\/p>\n<\/li>\n<\/ul>\n<h4 data-start=\"186\" data-end=\"210\"><strong data-start=\"190\" data-end=\"210\">Transaction Data<\/strong><\/h4>\n<ul>\n<li data-start=\"213\" data-end=\"307\"><strong data-start=\"213\" data-end=\"235\">Transaction Amount<\/strong> (<code data-start=\"237\" data-end=\"257\">transaction_amount<\/code>): Monetary value of the individual transaction.<\/li>\n<li data-start=\"310\" data-end=\"434\"><strong data-start=\"310\" data-end=\"346\">Average Daily Transaction Amount<\/strong> (<code data-start=\"348\" data-end=\"364\">avg_amount_day<\/code>): Mean value of transactions made with the card during a given day.<\/li>\n<li data-start=\"437\" data-end=\"573\"><strong data-start=\"437\" data-end=\"460\">Foreign Transaction<\/strong> (<code data-start=\"462\" data-end=\"483\">foreign_transaction<\/code>): Indicates whether the transaction was made outside the cardholder\u2019s country (Yes\/No).<\/li>\n<li data-start=\"576\" data-end=\"714\"><strong data-start=\"576\" data-end=\"597\">High-Risk Country<\/strong> (<code data-start=\"599\" data-end=\"618\">high_risk_country<\/code>): Flags if the transaction originated from a country considered high-risk for fraud (Yes\/No).<\/li>\n<li data-start=\"717\" data-end=\"824\"><strong data-start=\"717\" data-end=\"741\">Declined Transaction<\/strong> (<code data-start=\"743\" data-end=\"756\">is_declined<\/code>): Specifies if the credit card transaction was declined (Yes\/No).<\/li>\n<li data-start=\"827\" data-end=\"933\"><strong data-start=\"827\" data-end=\"851\">Daily Declines Count<\/strong> (<code data-start=\"853\" data-end=\"874\">number_declines_day<\/code>): Total number of declined transactions in a single day.<\/li>\n<\/ul>\n<h4 data-start=\"1075\" data-end=\"1117\"><strong data-start=\"1079\" data-end=\"1117\">Fraud Indicators &amp; Historical Data<\/strong><\/h4>\n<ul>\n<li data-start=\"1120\" data-end=\"1237\"><strong data-start=\"1120\" data-end=\"1155\">Daily Average Chargeback Amount<\/strong> (<code data-start=\"1157\" data-end=\"1177\">daily_chbk_avg_amt<\/code>): Average monetary value of chargebacks recorded per day.<\/li>\n<li data-start=\"1240\" data-end=\"1361\"><strong data-start=\"1240\" data-end=\"1277\">6-Month Average Chargeback Amount<\/strong> (<code data-start=\"1279\" data-end=\"1296\">6m_avg_chbk_amt<\/code>): Mean chargeback amount accumulated over the last six months.<\/li>\n<li data-start=\"1364\" data-end=\"1471\"><strong data-start=\"1364\" data-end=\"1396\">6-Month Chargeback Frequency<\/strong> (<code data-start=\"1398\" data-end=\"1412\">6m_chbk_freq<\/code>): Number of chargebacks recorded in the last six months.<\/li>\n<\/ul>\n<h4 data-start=\"1075\" data-end=\"1117\"><strong data-start=\"1079\" data-end=\"1117\">Target variable<\/strong><\/h4>\n<ul>\n<li data-start=\"1474\" data-end=\"1609\"><strong data-start=\"1474\" data-end=\"1518\">Fraudulent Transaction<\/strong>\u00a0(<code data-start=\"1520\" data-end=\"1535\">is_fraudulent<\/code>): Class label indicating whether the transaction was fraudulent or not.<\/li>\n<\/ul>\n<section id=\"DataSet\">\n<h3>Instances<\/h3>\n<p>On the other hand, the <a href=\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/data-set#Instances\">instances<\/a> are divided randomly into training, selection, and testing subsets, containing 60%, 20%, and 20% of the instances, respectively.<\/p>\n<h3>Variables distributions<\/h3>\n<p>Our target variable is <b>is_fraudulent<\/b>. We can calculate the data <a href=\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/data-set#Distributions\">distributions<\/a> and plot a pie chart with the percentage of instances for each class.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.neuraldesigner.com\/images\/credit_card_piechart.webp\" \/><\/p>\n<p>As we can see, the target variable is unbalanced, with many payments being non-fraudulent (approximately 85%), while only 15% are fraudulent. We could say that approximately 1 out of 6 payments is fraudulent.<\/p>\n<h3 style=\"font-family: Outfit, sans-serif; color: #242424;\">Inputs-targets correlations<\/h3>\n<p>The input-target correlations might indicate which factors have the most significant influence on a fraudulent transaction.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.neuraldesigner.com\/images\/credit_card_correlations.webp\" \/><\/p>\n<p>In this example, all variables have a positive correlation except for <i>is_declined<\/i>. Moreover, the variable <i>high_risk_country<\/i> has the highest correlation with the target variable.<\/p>\n<\/section>\n<section>\n<h2 id=\"NeuralNetwork\">3. Neural network<\/h2>\n<p>The next step is to set the <a href=\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/neural-network\">neural network<\/a> parameters. For classification problems, it is composed of:<\/p>\n<ul>\n<li>Scaling layer.<\/li>\n<li>Perceptron layers.<\/li>\n<li>Probabilistic layer.<\/li>\n<\/ul>\n<h3>Scaling layer<\/h3>\n<p>We have set the <a href=\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/neural-network#MeanStandardDeviationScalingMethod\">mean and standard deviation scaling method<\/a> for the <a href=\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/neural-network#ScalingLayer\">scaling layer<\/a>,<\/p>\n<h3>Dense layers<\/h3>\n<p>We set\u00a0<span style=\"box-sizing: border-box; margin: 0px; padding: 0px;\">up one\u00a0<a href=\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/neural-network#PerceptronsLayers\" target=\"_blank\" rel=\"noopener\">perceptron layer<\/a> with 3 neurons, using<\/span>\u00a0the <a href=\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/neural-network#LogisticActivationFunction\">logistic activation function<\/a>. This layer has nine inputs, and since the target variable is binary, it has only one output.<\/p>\n<p>The neural network for this example can be represented with the following diagram:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.neuraldesigner.com\/images\/credit_card_nn.webp\" \/><\/p>\n<\/section>\n<section id=\"TrainingStrategy\">\n<h2>4. Training strategy<\/h2>\n<p>The fourth step is to set the <a href=\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/training-strategy\">training strategy<\/a>, defining\u00a0what the neural network will learn. A general training strategy for classification is composed of two terms:<\/p>\n<ul>\n<li>A loss index.<\/li>\n<li>An optimization algorithm.<\/li>\n<\/ul>\n<h3>Loss index<\/h3>\n<p>The <a href=\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/training-strategy#LossIndex\">loss index<\/a> chosen for this problem is the <a href=\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/training-strategy#NormalizedSquaredError\">normalized squared error<\/a> between the neural network&#8217;s outputs and the targets in the data set with L1 regularization.<\/p>\n<p>The selected <a href=\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/training-strategy#OptimizationAlgorithm\">optimization algorithm<\/a> is the <a href=\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/training-strategy#QuasiNewtonMethod\">Quasi-Newton method<\/a>. The selected <a href=\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/training-strategy#OptimizationAlgorithm\">optimization algorithm<\/a> is the <a href=\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/training-strategy#QuasiNewtonMethod\">Quasi-Newton method<\/a>.<\/p>\n<p>The following chart illustrates how training and selection errors evolve over the course of training epochs. The final values are\u00a0<span style=\"box-sizing: border-box; margin: 0px; padding: 0px;\"><strong>a training error\u00a0<\/strong>of<strong>\u00a00.052\u00a0<\/strong>and a\u00a0<strong>selection error\u00a0<\/strong>of<strong> 0.103, both measured in<\/strong><\/span><b>\u00a0NSE<\/b>.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.neuraldesigner.com\/images\/creditcard_errorchart.webp\" \/><\/p>\n<\/section>\n<section id=\"ModelSelection\">\n<h2>5. Model selection<\/h2>\n<p>The objective of <a href=\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/model-selection\">model selection<\/a> is to find the network architecture with the best generalization properties, which means the one that minimizes the error on the <a href=\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/data-set#SelectionInstances\">selected instances<\/a> of the data set.<\/p>\n<p>More specifically, we want to find a neural network with a selection error smaller than <b>0.103 NSE<\/b>, which is the value we have achieved.<\/p>\n<p><a href=\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/model-selection#OrderSelection\">Order selection<\/a> algorithms train several network architectures with a different number of neurons and select the one with the smallest selection error.<\/p>\n<p>The <a href=\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/model-selection#IncrementalOrder\">incremental order<\/a> method starts with a few neurons and increases the complexity at each iteration. The following chart shows the training error (blue) and the selection error (orange) as a function of the number of neurons.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.neuraldesigner.com\/images\/creditcard_selectionerror.webp\" \/><\/p>\n<p>The selection errors achieved are similar for any number of variables; however, the smallest is <b>0.1007<\/b> for an optimal number of neurons of 4.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.neuraldesigner.com\/images\/credit_card_final_nn.webp\" \/><\/p>\n<p>The graph above represents the architecture of the final neural network.<\/p>\n<\/section>\n<section id=\"TestingAnalysis\">\n<h2>6. Testing analysis<\/h2>\n<p>The objective of the <a href=\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/testing-analysis\">testing analysis<\/a> is to validate the generalization performance of the trained neural network. To validate a classification technique, we need to compare the values provided by this technique to the observed values.<\/p>\n<h3>ROC curve<\/h3>\n<p>We can use the <a href=\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/testing-analysis#RocCurve\">ROC curve<\/a>\u00a0as it is the standard testing method for binary classification projects.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.neuraldesigner.com\/images\/creditcard_ROC.webp\" \/><\/p>\n<p>The AUC value for this example is 0.998.<\/p>\n<h3>Confusion matrix<\/h3>\n<p>The following table contains the elements of the <a href=\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/testing-analysis#ConfusionMatrix\">confusion matrix<\/a>.<\/p>\n<p>This matrix contains the true positives, false positives, false negatives, and true negatives for the variable <i>is_fraudulent<\/i>.<\/p>\n<table>\n<tbody>\n<tr>\n<th><\/th>\n<th>Predicted positive<\/th>\n<th>Predicted negative<\/th>\n<\/tr>\n<tr>\n<th>Real positive<\/th>\n<td style=\"text-align: right;\">79 (12%)<\/td>\n<td style=\"text-align: right;\">5 (0%)<\/td>\n<\/tr>\n<tr>\n<th>Real negative<\/th>\n<td style=\"text-align: right;\">8 (1%)<\/td>\n<td style=\"text-align: right;\">523 (85%)<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>The total number of testing samples is 615. Therefore, the number of correctly classified samples is 602 (97%), and the number of misclassified samples is 13 (2%).<\/p>\n<h3>Binary classification tests<\/h3>\n<p>The <a href=\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/testing-analysis#BinaryClassificationTests\">binary classification tests<\/a> are parameters for measuring the performance of a classification problem with two classes:<\/p>\n<ul>\n<li><b>Classification accuracy<\/b> (ratio of instances correctly classified): 97.9%<\/li>\n<li><b>Error rate<\/b> (ratio of instances misclassified): 2.1%<\/li>\n<li><b>Sensitivity<\/b> (ratio of real positives the model classifies as positives): 94%<\/li>\n<li><b>Specificity<\/b> (ratio of real negatives the model classifies as negatives): 98.5%<\/li>\n<\/ul>\n<p>We have correctly classified 94% of the fraudulent payments, enabling us to identify approximately 19 out of 20 fraudulent charges.<\/p>\n<p>We can also observe these results in the <a href=\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/testing-analysis#PositivesNegativesRates\"> positive rates<\/a> chart:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.neuraldesigner.com\/images\/credit_card_positive_rates.webp\" \/><\/p>\n<p>The initial positive rate was approximately 15%, and after applying our model, it has increased to 92%. This means we could recognize six times more fraudulent payments with this model.<\/p>\n<h3>Cumulative gain<\/h3>\n<p>We can also perform\u00a0<span style=\"box-sizing: border-box; margin: 0px; padding: 0px;\">a\u00a0<a href=\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/testing-analysis#CumulativeGain\" target=\"_blank\" rel=\"noopener\">cumulative gain<\/a> analysis, a visual aid that shows<\/span>\u00a0the advantage of using a predictive model over randomness.<\/p>\n<p>It consists of three lines. The baseline represents the results that would be obtained without using a model. The positive cumulative gain is shown on the y-axis as the percentage of positive instances found against the population represented on the x-axis.<br \/>\nSimilarly, the negative cumulative gain indicates the percentage of negative instances found within the population.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.neuraldesigner.com\/images\/credit_card_cumulative_gain.webp\" \/><\/p>\n<p>In this case, by using the model, we see that analyzing 20% of the payments with a higher probability of being fraudulent would enable us to reach 100% of the fraudulent charges.<\/p>\n<\/section>\n<section id=\"ModelDeployment\">\n<h2>7. Model deployment<\/h2>\n<p>After all the steps, the model obtained is not the best for achieving this goal. Nevertheless, it is still better than randomly guessing.<\/p>\n<p>We can calculate the <a href=\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/model-deployment#NeuralNetworkOutputs\">neural network outputs<\/a> for a given set of inputs:<\/p>\n<ul>\n<li><b>avg_amount_day:<\/b> 515.026.<\/li>\n<li><b>transaction_amount:<\/b> 9876.4.<\/li>\n<li><b>is_declined:<\/b> no.<\/li>\n<li><b>number_declines_day:<\/b> 0.957398.<\/li>\n<li><b>foreign_transaction:<\/b> yes.<\/li>\n<li><b>high_risk_country:<\/b> yes.<\/li>\n<li><b>daily_chbk_avg_amt:<\/b> 55.7376.<\/li>\n<li><b>6m_avg_chbk_amt:<\/b> 40.0224.<\/li>\n<li><b>6m_chbk_freq:<\/b> 0.39187.<\/li>\n<\/ul>\n<p>The predicted output for these input values is the following:<\/p>\n<ul>\n<li><span style=\"box-sizing: border-box; margin: 0px; padding: 0px;\"><strong>is_fraudulent:<\/strong> 96% probability of being fraudulent.<\/span><\/li>\n<\/ul>\n<p>The following listing shows the <a href=\"https:\/\/www.neuraldesigner.com\/learning\/tutorials\/model-deployment#MathematicalExpression\">mathematical expression<\/a> of the predictive model.<\/p>\n<pre>scaled_avg_amount_days = avg_amount_days*(1+1)\/(2000-(4.01153))-4.01153*(1+1)\/(2000-4.01153)-1;\r\nscaled_transaction_amount = transaction_amount*(1+1)\/(108000-(0))-0*(1+1)\/(108000-0)-1;\r\nscaled_is_declined = is_declined*(1+1)\/(1-(0))-0*(1+1)\/(1-0)-1;\r\nscaled_number_declines_days = number_declines_days*(1+1)\/(20-(0))-0*(1+1)\/(20-0)-1;\r\nscaled_foreign_transaction = foreign_transaction*(1+1)\/(1-(0))-0*(1+1)\/(1-0)-1;\r\nscaled_high_risk_countries = high_risk_countries*(1+1)\/(1-(0))-0*(1+1)\/(1-0)-1;\r\nscaled_daily_chbk_avg_amt = daily_chbk_avg_amt*(1+1)\/(998-(0))-0*(1+1)\/(998-0)-1;\r\nscaled_6m_avg_chbk_amt = 6m_avg_chbk_amt*(1+1)\/(998-(0))-0*(1+1)\/(998-0)-1;\r\nscaled_6m_chbk_freq = 6m_chbk_freq*(1+1)\/(9-(0))-0*(1+1)\/(9-0)-1;\r\nperceptron_layer_0_output_0 = sigma[ -0.730652 + (scaled_avg_amount_days*0.347961)+ (scaled_transaction_amount*-0.866882)+ (scaled_is_declined*0.698547)+ (scaled_number_declines_days*-0.679199)+ (scaled_foreign_transaction*-0.744385)+ (scaled_high_risk_countries*-0.223877)+ (scaled_daily_chbk_avg_amt*-0.948853)+ (scaled_6m_avg_chbk_amt*0.281616)+ (scaled_6m_chbk_freq*-0.272766) ];\r\nperceptron_layer_0_output_1 = sigma[ 0.757568 + (scaled_avg_amount_days*0.0680542)+ (scaled_transaction_amount*-0.254028)+ (scaled_is_declined*-0.58905)+ (scaled_number_declines_days*0.920654)+ (scaled_foreign_transaction*0.0759888)+ (scaled_high_risk_countries*0.961853)+ (scaled_daily_chbk_avg_amt*0.0324707)+ (scaled_6m_avg_chbk_amt*0.283447)+ (scaled_6m_chbk_freq*0.200012) ];\r\nperceptron_layer_0_output_2 = sigma[ -0.406372 + (scaled_avg_amount_days*0.268921)+ (scaled_transaction_amount*0.124512)+ (scaled_is_declined*0.815247)+ (scaled_number_declines_days*-0.362366)+ (scaled_foreign_transaction*0.486023)+ (scaled_high_risk_countries*0.997009)+ (scaled_daily_chbk_avg_amt*0.286682)+ (scaled_6m_avg_chbk_amt*0.97644)+ (scaled_6m_chbk_freq*-0.848083) ];\r\nperceptron_layer_0_output_3 = sigma[ 0.529846 + (scaled_avg_amount_days*-0.871521)+ (scaled_transaction_amount*0.977722)+ (scaled_is_declined*-0.771179)+ (scaled_number_declines_days*0.671753)+ (scaled_foreign_transaction*-0.0239868)+ (scaled_high_risk_countries*-0.501465)+ (scaled_daily_chbk_avg_amt*0.620178)+ (scaled_6m_avg_chbk_amt*-0.797546)+ (scaled_6m_chbk_freq*-0.429626) ];\r\nprobabilistic_layer_combinations_0 = -0.745667 -0.556274*perceptron_layer_0_output_0 -0.661987*perceptron_layer_0_output_1 +0.70813*perceptron_layer_0_output_2 -0.882507*perceptron_layer_0_output_3 \r\nis_fradulent = 1.0\/(1.0 + exp(-probabilistic_layer_combinations_0);\r\n<\/pre>\n<p>This formula can also be exported to the software tool the company requires.<\/p>\n<\/section>\n<section id=\"TutorialVideo\">\n<h2>8. Video tutorial<\/h2>\n<p>You can watch the step-by-step tutorial video below to help you complete this Machine Learning example for free using the powerful machine learning software <a href=\"https:\/\/www.neuraldesigner.com\/free-trial\">Neural Designer<\/a>.<\/p>\n<p><iframe src=\"https:\/\/www.youtube.com\/embed\/-d7iQi1I-9c\" width=\"560\" height=\"315\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n<\/section>\n<section>\n<h2>References<\/h2>\n<ul>\n<li>The data for this problem has been taken from the Machine Learning <a href=\"https:\/\/www.kaggle.com\/anmolkumar\/health-insurance-cross-sell-prediction\">Kaggle Repository<\/a>.<\/li>\n<\/ul>\n<\/section>\n<section>\n<h2>Related posts<\/h2>\n<\/section>\n","protected":false},"author":13,"featured_media":2367,"template":"","categories":[29],"tags":[47],"class_list":["post-3479","learning","type-learning","status-publish","has-post-thumbnail","hentry","category-examples","tag-finance"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Detect fraud in credit card transactions using machine learning<\/title>\n<meta name=\"description\" content=\"Build a machine learning model to detect credit card fraud, based on 11 features for about 3,075 payments.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.neuraldesigner.com\/learning\/examples\/credit-card-fraud\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Credit card fraud detection machine learning example\" \/>\n<meta property=\"og:description\" content=\"Credit card fraud is when someone uses your credit card or credit account to make a purchase you didn&#039;t authorize. This activity can happen in different ways: If you lose your credit card or have it stolen, it can be used to make purchases or other payments, either in person or online.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.neuraldesigner.com\/learning\/examples\/credit-card-fraud\/\" \/>\n<meta property=\"og:site_name\" content=\"Neural Designer\" \/>\n<meta property=\"article:modified_time\" content=\"2026-02-12T11:50:54+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.neuraldesigner.com\/wp-content\/uploads\/2023\/06\/credit_card_fraud.webp\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/webp\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:title\" content=\"Credit card fraud detection machine learning example\" \/>\n<meta name=\"twitter:description\" content=\"Credit card fraud is when someone uses your credit card or credit account to make a purchase you didn&#039;t authorize. This activity can happen in different ways: If you lose your credit card or have it stolen, it can be used to make purchases or other payments, either in person or online.\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/www.neuraldesigner.com\/wp-content\/uploads\/2023\/06\/credit_card_fraud.webp\" \/>\n<meta name=\"twitter:site\" content=\"@NeuralDesigner\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.neuraldesigner.com\/learning\/examples\/credit-card-fraud\/\",\"url\":\"https:\/\/www.neuraldesigner.com\/learning\/examples\/credit-card-fraud\/\",\"name\":\"Detect fraud in credit card transactions using machine learning\",\"isPartOf\":{\"@id\":\"https:\/\/www.neuraldesigner.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.neuraldesigner.com\/learning\/examples\/credit-card-fraud\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.neuraldesigner.com\/learning\/examples\/credit-card-fraud\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.neuraldesigner.com\/wp-content\/uploads\/2023\/06\/credit_card_fraud.webp\",\"datePublished\":\"2023-08-31T11:12:59+00:00\",\"dateModified\":\"2026-02-12T11:50:54+00:00\",\"description\":\"Build a machine learning model to detect credit card fraud, based on 11 features for about 3,075 payments.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.neuraldesigner.com\/learning\/examples\/credit-card-fraud\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.neuraldesigner.com\/learning\/examples\/credit-card-fraud\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.neuraldesigner.com\/learning\/examples\/credit-card-fraud\/#primaryimage\",\"url\":\"https:\/\/www.neuraldesigner.com\/wp-content\/uploads\/2023\/06\/credit_card_fraud.webp\",\"contentUrl\":\"https:\/\/www.neuraldesigner.com\/wp-content\/uploads\/2023\/06\/credit_card_fraud.webp\",\"width\":1200,\"height\":628},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.neuraldesigner.com\/learning\/examples\/credit-card-fraud\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.neuraldesigner.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Learning\",\"item\":\"https:\/\/www.neuraldesigner.com\/learning\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Detect fraud in credit card transactions using machine learning\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.neuraldesigner.com\/#website\",\"url\":\"https:\/\/www.neuraldesigner.com\/\",\"name\":\"Neural Designer\",\"description\":\"Explanable AI Platform\",\"publisher\":{\"@id\":\"https:\/\/www.neuraldesigner.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.neuraldesigner.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.neuraldesigner.com\/#organization\",\"name\":\"Neural Designer\",\"url\":\"https:\/\/www.neuraldesigner.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.neuraldesigner.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.neuraldesigner.com\/wp-content\/uploads\/2023\/05\/logo-neural-1.png\",\"contentUrl\":\"https:\/\/www.neuraldesigner.com\/wp-content\/uploads\/2023\/05\/logo-neural-1.png\",\"width\":1024,\"height\":223,\"caption\":\"Neural Designer\"},\"image\":{\"@id\":\"https:\/\/www.neuraldesigner.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/x.com\/NeuralDesigner\",\"https:\/\/es.linkedin.com\/showcase\/neuraldesigner\/\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Detect fraud in credit card transactions using machine learning","description":"Build a machine learning model to detect credit card fraud, based on 11 features for about 3,075 payments.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.neuraldesigner.com\/learning\/examples\/credit-card-fraud\/","og_locale":"en_US","og_type":"article","og_title":"Credit card fraud detection machine learning example","og_description":"Credit card fraud is when someone uses your credit card or credit account to make a purchase you didn't authorize. This activity can happen in different ways: If you lose your credit card or have it stolen, it can be used to make purchases or other payments, either in person or online.","og_url":"https:\/\/www.neuraldesigner.com\/learning\/examples\/credit-card-fraud\/","og_site_name":"Neural Designer","article_modified_time":"2026-02-12T11:50:54+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/www.neuraldesigner.com\/wp-content\/uploads\/2023\/06\/credit_card_fraud.webp","type":"image\/webp"}],"twitter_card":"summary_large_image","twitter_title":"Credit card fraud detection machine learning example","twitter_description":"Credit card fraud is when someone uses your credit card or credit account to make a purchase you didn't authorize. This activity can happen in different ways: If you lose your credit card or have it stolen, it can be used to make purchases or other payments, either in person or online.","twitter_image":"https:\/\/www.neuraldesigner.com\/wp-content\/uploads\/2023\/06\/credit_card_fraud.webp","twitter_site":"@NeuralDesigner","twitter_misc":{"Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.neuraldesigner.com\/learning\/examples\/credit-card-fraud\/","url":"https:\/\/www.neuraldesigner.com\/learning\/examples\/credit-card-fraud\/","name":"Detect fraud in credit card transactions using machine learning","isPartOf":{"@id":"https:\/\/www.neuraldesigner.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.neuraldesigner.com\/learning\/examples\/credit-card-fraud\/#primaryimage"},"image":{"@id":"https:\/\/www.neuraldesigner.com\/learning\/examples\/credit-card-fraud\/#primaryimage"},"thumbnailUrl":"https:\/\/www.neuraldesigner.com\/wp-content\/uploads\/2023\/06\/credit_card_fraud.webp","datePublished":"2023-08-31T11:12:59+00:00","dateModified":"2026-02-12T11:50:54+00:00","description":"Build a machine learning model to detect credit card fraud, based on 11 features for about 3,075 payments.","breadcrumb":{"@id":"https:\/\/www.neuraldesigner.com\/learning\/examples\/credit-card-fraud\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.neuraldesigner.com\/learning\/examples\/credit-card-fraud\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.neuraldesigner.com\/learning\/examples\/credit-card-fraud\/#primaryimage","url":"https:\/\/www.neuraldesigner.com\/wp-content\/uploads\/2023\/06\/credit_card_fraud.webp","contentUrl":"https:\/\/www.neuraldesigner.com\/wp-content\/uploads\/2023\/06\/credit_card_fraud.webp","width":1200,"height":628},{"@type":"BreadcrumbList","@id":"https:\/\/www.neuraldesigner.com\/learning\/examples\/credit-card-fraud\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.neuraldesigner.com\/"},{"@type":"ListItem","position":2,"name":"Learning","item":"https:\/\/www.neuraldesigner.com\/learning\/"},{"@type":"ListItem","position":3,"name":"Detect fraud in credit card transactions using machine learning"}]},{"@type":"WebSite","@id":"https:\/\/www.neuraldesigner.com\/#website","url":"https:\/\/www.neuraldesigner.com\/","name":"Neural Designer","description":"Explanable AI Platform","publisher":{"@id":"https:\/\/www.neuraldesigner.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.neuraldesigner.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.neuraldesigner.com\/#organization","name":"Neural Designer","url":"https:\/\/www.neuraldesigner.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.neuraldesigner.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.neuraldesigner.com\/wp-content\/uploads\/2023\/05\/logo-neural-1.png","contentUrl":"https:\/\/www.neuraldesigner.com\/wp-content\/uploads\/2023\/05\/logo-neural-1.png","width":1024,"height":223,"caption":"Neural Designer"},"image":{"@id":"https:\/\/www.neuraldesigner.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/NeuralDesigner","https:\/\/es.linkedin.com\/showcase\/neuraldesigner\/"]}]}},"_links":{"self":[{"href":"https:\/\/www.neuraldesigner.com\/api\/wp\/v2\/learning\/3479","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.neuraldesigner.com\/api\/wp\/v2\/learning"}],"about":[{"href":"https:\/\/www.neuraldesigner.com\/api\/wp\/v2\/types\/learning"}],"author":[{"embeddable":true,"href":"https:\/\/www.neuraldesigner.com\/api\/wp\/v2\/users\/13"}],"version-history":[{"count":1,"href":"https:\/\/www.neuraldesigner.com\/api\/wp\/v2\/learning\/3479\/revisions"}],"predecessor-version":[{"id":21939,"href":"https:\/\/www.neuraldesigner.com\/api\/wp\/v2\/learning\/3479\/revisions\/21939"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.neuraldesigner.com\/api\/wp\/v2\/media\/2367"}],"wp:attachment":[{"href":"https:\/\/www.neuraldesigner.com\/api\/wp\/v2\/media?parent=3479"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.neuraldesigner.com\/api\/wp\/v2\/categories?post=3479"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.neuraldesigner.com\/api\/wp\/v2\/tags?post=3479"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}