{"id":16749,"date":"2020-07-29T23:53:02","date_gmt":"2020-07-29T18:23:02","guid":{"rendered":"https:\/\/www.mygreatlearning.com\/blog\/anomaly-detection-using-machine-learning\/"},"modified":"2024-09-03T17:26:25","modified_gmt":"2024-09-03T11:56:25","slug":"anomaly-detection-using-machine-learning","status":"publish","type":"post","link":"https:\/\/www.mygreatlearning.com\/blog\/anomaly-detection-using-machine-learning\/","title":{"rendered":"Anomaly Detection using Machine Learning | How Machine Learning Can Enable Anomaly Detection?"},"content":{"rendered":"\n<p>Anomaly detection is something similar to how our human brains are always trying to recognize something abnormal or out of the \u201cnormal\u201d or the \u201cusual stuff.\u201d Anomaly is basically&nbsp; that does not fit with the usual pattern. Abnormal growth of data or some pattern which is not similar with the other part of the data and our data science concepts and tools are also trying to look for anomalies that do not maintain the normal data flow.<\/p>\n\n\n\n<p>So to understand more intuitively let me give you an example like an \u201cunusually high\u201d number of login attempts to some particular account may point to a potential cyberattack, or a huge amount of transaction with credit card can be a reason for fraud transaction. Also, check put this<a href=\"https:\/\/www.mygreatlearning.com\/academy\/learn-for-free\/courses\/fake-news-detection-using-machine-learning2\" target=\"_blank\" rel=\"noreferrer noopener\"> Fake news detection using machine learning<\/a> course today.<\/p>\n\n\n\n<p>So In this blog we will discuss about:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong><a href=\"#sh1\">What is Anomaly detection?&nbsp;<\/a><\/strong><\/li>\n\n\n\n<li><a href=\"#sh2\"><strong>Why do we need Anomaly detection?<\/strong><\/a><\/li>\n\n\n\n<li><a href=\"#sh3\"><strong>Types of Anomaly detection<\/strong><\/a><\/li>\n\n\n\n<li><a href=\"#sh4\"><strong>Benefits and applications of Anomaly detection&nbsp;<\/strong><\/a><\/li>\n\n\n\n<li><a href=\"#sh5\"><strong>Machine learning methods to do anomaly detection<\/strong><\/a><\/li>\n\n\n\n<li><a href=\"#sh6\"><strong>Machine Learning and Outlier Analysis<\/strong><\/a><\/li>\n\n\n\n<li><strong><a href=\"#sh7\">Project with anomaly detection<\/a><\/strong><\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"what-is-anomaly-detection\">What is Anomaly Detection?<\/h2>\n\n\n\n<p>Anomaly Detection is basically a technique to identify rare events or observations. These events or the observations&nbsp; can be a cause of&nbsp; suspicious activity. Because these observations are statistically different from the rest of the observations. Examples of such activities are known as anomaly in the dataset and these behaviours are known as &nbsp; \u201canomalous\u201d behaviour and&nbsp; typically the reason for some kind of a problem like a credit card fraud, failing machine in a server, a cyber attack, or some other kind of serious issues.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"why-do-we-need-anomaly-detection\">Why do we need Anomaly Detection?<\/h2>\n\n\n\n<p>We all know that Machine Learning has four parts or classes of applications:&nbsp;<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>classification,&nbsp;<\/li>\n\n\n\n<li>predicting the next upcoming value,&nbsp;<\/li>\n\n\n\n<li>anomaly detection,&nbsp;<\/li>\n\n\n\n<li>and discovering structure.<\/li>\n<\/ol>\n\n\n\n<p>From these four classes Anomaly detection helps to detect data points from the dataset&nbsp; that do not fit well or not behaving normally with the rest of the data. The applications for this particular class are fraud detection, surveillance, diagnosis, data cleanup, and predictive maintenance etc.<\/p>\n\n\n\n<p>The advent of IoT and&nbsp; anomaly detection is now playing a&nbsp; key role in IoT applications as well&nbsp; such as monitoring and predictive maintenance.<\/p>\n\n\n\n<p>Modern businesses are now becoming dependent on the data and they try to forecast their sales with the base of these new technologies and they have started understanding&nbsp; the importance of interconnected operations to get the full schema of their business.At the same time they need to respond and take actions&nbsp; to fast-moving changes in data promptly. Especially if we talk about the cybersecurity threats and rapid changes in their domain. To solve these heart throbbing problems anomaly detection can be a key or a bright side&nbsp; for solving such intrusions. And unfortunately, we have no other effective way to handle and analyze constantly growing datasets manually. In constantly changing data \u201cnormal\u201d behavior is redefining each and every moment, and a new effective, proactive approach to identify anomalous behaviour can be find using these concepts.<\/p>\n\n\n\n<p>So to get and use all the features anomaly detection is needed to identify the anomaly of the data.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"types-of-anomaly-detection\">Types of Anomaly detection<\/h2>\n\n\n\n<p>These anomalies can be divided into three categories:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Point Anomaly: An individual data instance in a dataset is considered to be a Point Anomaly if it belongs to far away from the rest of the data.<\/li>\n<\/ol>\n\n\n\n<p>Example: Sudden transaction of huge amount from a credit card<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Contextual Anomaly: If a particular observation is anomalous from other data points then this is called a Contextual Anomaly. Or if the data is&nbsp; an anomaly because of the context of the observation.<\/li>\n\n\n\n<li>Collective Anomaly: Collective Anomaly are known as a set of data instances that help in finding an anomaly. This type of anomaly&nbsp; has two variations.<\/li>\n<\/ol>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Events are in unexpected order&nbsp;<\/li>\n\n\n\n<li>Unexpected value combinations&nbsp;<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"benefits-and-application-of-anomaly-detection\">Benefits and application of anomaly detection:<\/h2>\n\n\n\n<p>Artificial Intelligence helps our human resources to handle the elastic environment of cloud infrastructure, microservices and containers. We use artificial intelligence concepts everywhere to overcome these challenges.<\/p>\n\n\n\n<p>So let me give you some examples of anomaly detection,<\/p>\n\n\n\n<p>Suppose in the automation Industry they start using AI-driven anomaly detection algorithms that can automatically analyze and understand the datasets. These algorithms are too efficient for that they can dynamically fine-tune the parameters of normal behavior and identify breaches in the patterns.<\/p>\n\n\n\n<p>Real-time analysis: In the real time analysis industry also AI solutions can interpret data activity in real time. Basically here AI tries to check the pattern and compare them. At any moment if a pattern is not recognized by the system, then the system will send a signal as soon as possible.<\/p>\n\n\n\n<p>Scrupulousness: In this application of anomaly detection basically helps to provide an end-to-end gap-free monitoring which can go through minutiae of data. By this application we can identify the smallest anomalies in the data which is almost impossible for a human eye&nbsp; to find out.<\/p>\n\n\n\n<p>Accuracy:When it comes to comparing the accuracy between AI and the human resource we always notice that Artificial Intelligence is far better to deal with anomaly detection.&nbsp; Artificial Intelligence helps to enhance the accuracy of anomaly detection with avoiding nuisance alerts and false positives\/negatives triggered by static thresholds.&nbsp;<\/p>\n\n\n\n<p>Self-learning: We all have the idea about self driving&nbsp; cars and Tesla Self driving cars are also very famous so this industry is also using Artificial Intelligence concepts. So the heart of this industry is based on AI-driven algorithms which constitute the core of self-learning systems. These systems are able to learn from data patterns and deliver predictions or answers as required.<\/p>\n\n\n\n    <div class=\"courses-cta-container\">\n        <div class=\"courses-cta-card\">\n            <div class=\"courses-cta-header\">\n                <div class=\"courses-learn-icon\"><\/div>\n                <span class=\"courses-learn-text\">Advance Your Data Science Career<\/span>\n            <\/div>\n            <p class=\"courses-cta-title\">\n                <a href=\"https:\/\/www.mygreatlearning.com\/pg-program-data-science-and-business-analytics-course\" class=\"courses-cta-title-link\">Post Graduate Program in Data Science<\/a>\n            <\/p>\n            <p class=\"courses-cta-description\">Master data science skills with a focus on in-demand Gen AI through real-world projects and expert-led learning.<\/p>\n            <div class=\"courses-cta-stats\">\n                <div class=\"courses-stat-item\">\n                    <div class=\"courses-stat-icon courses-user-icon\"><\/div>\n                    <span>Duration: 12 months<\/span>\n                <\/div>\n                <div class=\"courses-stat-item\">\n                    <div class=\"courses-stat-icon courses-star-icon\"><\/div>\n                    <span>Ratings: 4.78<\/span>\n                <\/div>\n            <\/div>\n            <a href=\"https:\/\/www.mygreatlearning.com\/pg-program-data-science-and-business-analytics-course\" class=\"courses-cta-button\">\n                Explore the Course\n                <div class=\"courses-arrow-icon\"><\/div>\n            <\/a>\n        <\/div>\n    <\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"machine-learning-methods-to-do-anomaly-detection\">Machine learning methods to do anomaly detection:<\/h2>\n\n\n\n<p>What is Machine Learning?<\/p>\n\n\n\n<p><a href=\"https:\/\/www.mygreatlearning.com\/blog\/what-is-machine-learning\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"Machine learning (opens in a new tab)\">Machine learning<\/a> is a sub-set of artificial intelligence (AI) that allows the system to automatically learn and improve from experience without being explicitly programmed<\/p>\n\n\n\n<p>Three types are there in machine learning:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Supervised<\/li>\n\n\n\n<li>Unsupervised<\/li>\n\n\n\n<li>Reinforcement learning<\/li>\n<\/ol>\n\n\n\n<p>What is supervised learning?<\/p>\n\n\n\n<p>From the name itself, we can understand supervised learning works as a supervisor or teacher. Basically, In supervised learning, we teach or train the machine with labeled data (that means data is already tagged with some predefined class). Then we test our model with some unknown new set of data and predict the level for them.<\/p>\n\n\n\n<p>What is unsupervised learning?<\/p>\n\n\n\n<p>Unsupervised learning is a machine learning technique, where you do not need to supervise the model. Instead, you need to allow the model to work on its own to discover information. It mainly deals with the unlabeled data.<\/p>\n\n\n\n<p>What is Reinforcement Learning?<\/p>\n\n\n\n<p>Reinforcement learning is about taking suitable action to maximize reward in a particular situation. It is used to define the best sequence of decisions that allow the agent to solve a problem while maximizing a long-term reward.<\/p>\n\n\n\n    <div class=\"courses-cta-container\">\n        <div class=\"courses-cta-card\">\n            <div class=\"courses-cta-header\">\n                <div class=\"courses-learn-icon\"><\/div>\n                <span class=\"courses-learn-text\">Texas McCombs, UT Austin<\/span>\n            <\/div>\n            <p class=\"courses-cta-title\">\n                <a href=\"https:\/\/onlineexeced.mccombs.utexas.edu\/online-ai-machine-learning-course\" class=\"courses-cta-title-link\">Post Graduate Program in AI &amp; Machine Learning: Business Applications<\/a>\n            <\/p>\n            <p class=\"courses-cta-description\">Master in-demand AI and machine learning skills with this executive-level AI course\u2014designed to transform professionals into strategic tech leaders.<\/p>\n            <div class=\"courses-cta-stats\">\n                <div class=\"courses-stat-item\">\n                    <div class=\"courses-stat-icon courses-user-icon\"><\/div>\n                    <span>Duration: 7 months<\/span>\n                <\/div>\n                <div class=\"courses-stat-item\">\n                    <div class=\"courses-stat-icon courses-star-icon\"><\/div>\n                    <span>4.72\/5 Rating<\/span>\n                <\/div>\n            <\/div>\n            <a href=\"https:\/\/onlineexeced.mccombs.utexas.edu\/online-ai-machine-learning-course\" class=\"courses-cta-button\">\n                Take your First Step\n                <div class=\"courses-arrow-icon\"><\/div>\n            <\/a>\n        <\/div>\n    <\/div>\n\n\n\n<h2 id=\"machine-learning-and-outlier-analysis\">Machine Learning and Outlier Analysis<\/h2>\n\n\n\n<p>What is an outlier?<\/p>\n\n\n\n<p>An outlier in the data basically stands for identifying any&nbsp; data object or point that significantly deviates from the remaining data points. In the concept of data mining, outliers are commonly considered as an exception or simply noise to the data. But the same process cannot be applied in anomaly detection, hence the emphasis on outlier analysis.<\/p>\n\n\n\n<p>Let me give you an example about performing anomaly detection using machine learning. This method is the K-means clustering method.<\/p>\n\n\n\n<p>What is K means clustering?<\/p>\n\n\n\n<p>&nbsp;K-means clustering is a part of unsupervised learning in the machine learning algorithm. This algorithm is used for the unlabeled data (i.e.,The&nbsp; data without defined categories, class, or groups). The goal of this K-means algorithm is to find the specific groups in the data, with the number of groups represented by the variable K. The algorithm normally works iteratively to put&nbsp; and classify each data point to one of K groups based on the features the data points have. These&nbsp; data points are clustered based on feature similarity.&nbsp;<\/p>\n\n\n\n<p>The results we got from the&nbsp; K-means clustering algorithm are:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>&nbsp;The centroids of the K clusters, which are used to label new data&nbsp;<\/li>\n\n\n\n<li>Labels for the each data points in the training data (each data point is assigned to a single cluster)<\/li>\n<\/ol>\n\n\n\n<p>So this algorithm K-means clustering method is applied to detect the outlier based on their plotted distance from the closest cluster.<\/p>\n\n\n\n<p>K-means clustering method helps the form the different types of&nbsp; clusters for each&nbsp; data point in the dataset with a mean value. Normally we observe that objects within a cluster have the closest mean value. Any object if it has the threshold value greater than the nearest cluster mean value then that is identified as an outlier.&nbsp;<\/p>\n\n\n\n<p>Step-by-step method implementation to use K-means clustering:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>First calculate the mean value of each cluster<\/li>\n\n\n\n<li>Then try to set an initial threshold value<\/li>\n\n\n\n<li>When the testing process is going in that time try to&nbsp; determine the distance of each data point from the mean value<\/li>\n\n\n\n<li>Find or Identify the cluster which&nbsp; is nearest to the test data point<\/li>\n\n\n\n<li>If we observe that the \u201cDistance\u201d value is more than the \u201cthreshold\u201d value, then we can conclude that it is an outlier.<\/li>\n<\/ol>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Supervised Anomaly Detection:<\/li>\n<\/ol>\n\n\n\n<p>As we are already familiar with that, the&nbsp; supervised learning method needs a labeled dataset. This dataset can&nbsp; contain both the&nbsp; normal and the anomalous samples to construct a predictive model. This dataset helps us&nbsp; to classify future data points. The most commonly and famous&nbsp; used algorithms for this purpose are supervised learning processes like, <a aria-label=\"Support Vector Machine learning (opens in a new tab)\" href=\"https:\/\/www.mygreatlearning.com\/blog\/introduction-to-support-vector-machine\/\" target=\"_blank\" rel=\"noreferrer noopener\">Support Vector Machine learning<\/a>, <a href=\"https:\/\/www.mygreatlearning.com\/academy\/learn-for-free\/courses\/machine-learning-modelling\" target=\"_blank\" rel=\"noreferrer noopener\">Machine learning modelling<\/a>, K-Nearest Neighbors Classifier, etc.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Unsupervised Anomaly Detection:<\/li>\n<\/ol>\n\n\n\n<p>So in the beginning of this tutorial we have learned about unsupervised learning as well.&nbsp;<\/p>\n\n\n\n<p>Unsupervised anomaly detection algorithms are divided into some parts like:&nbsp;<\/p>\n\n\n\n<p>(1) Nearest-neighbor based techniques,<\/p>\n\n\n\n<p>&nbsp;(2) Clustering-based methods and<\/p>\n\n\n\n<p>&nbsp;(3) Statistical algorithms.<\/p>\n\n\n\n<p>This learning process does not require any training data and instead of that it automatically assumes two things about the data:<\/p>\n\n\n\n<p>&nbsp;A very small percentage of data is anomalous in the whole dataset<\/p>\n\n\n\n<p>And the second one is&nbsp; that any anomaly is statistically different from the normal samples.&nbsp;<\/p>\n\n\n\n<p>Based on these two assumptions, the data is then process to cluster using the similarity measurement and the data points in the dataset which are far away from the cluster they are considered as the&nbsp; anomalies.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"project-with-anomaly-detection\">Project with anomaly detection:<\/h2>\n\n\n\n<p>Credit card Fraud Analysis:<\/p>\n\n\n\n<h5 class=\"wp-block-heading\" id=\"project-credit-card-fraud-analysis-using-data-mining-techniques\"><strong>Project: Credit card Fraud Analysis using Data mining techniques<\/strong><\/h5>\n\n\n\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" src=\"https:\/\/www.mygreatlearning.com\/academy\/career\/wp-content\/uploads\/2020\/07\/FAVPNG_internet-safety-theft-credit-card-fraud_pubQ3m3m-296x300.png\" alt=\"\" class=\"wp-image-34215\"\/><\/figure>\n\n\n\n<p>IN today\u2019s world, we are literally sitting on the express train to become a cashless society. As per the <a href=\"https:\/\/worldpaymentsreport.com\/wp-content\/uploads\/sites\/5\/2018\/10\/World-Payments-Report-2018.pdf\">World Payments Report<\/a>, in 2016 total non-cash transactions increased by 10.1% from 2015 for a total of 482.6 billion transactions! That\u2019s huge! Also, it\u2019s expected that in future years there will be a steady growth of non-cash transactions.<\/p>\n\n\n\n<p>As this is a blessing on the other hand it becomes a curse for this cashless society because of the immense number of fraud transactions even if EMV smart chips are also implemented.<\/p>\n\n\n\n<p>So our data scientists are trying to come up with one of the best solutions to make a model for predicting fraud transactions.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\" id=\"import-the-libraries\">Import the libraries:<\/h5>\n\n\n\n<pre class=\"wp-block-preformatted\">import&nbsp;pandas&nbsp;as&nbsp;pd&nbsp;\n\nimport&nbsp;numpy&nbsp;as&nbsp;np\n\nimport&nbsp;matplotlib\n\nimport&nbsp;matplotlib.pyplot&nbsp;as&nbsp;plt\n\n%matplotlib&nbsp;inline&nbsp;\n\nimport&nbsp;matplotlib.pyplot&nbsp;as&nbsp;plt\n\nfrom&nbsp;sklearn.model_selection&nbsp;import&nbsp;train_test_split&nbsp;\n\nfrom&nbsp;sklearn.metrics&nbsp;import&nbsp;classification_report,&nbsp;accuracy_score&nbsp;&nbsp;\n\nfrom&nbsp;sklearn.metrics&nbsp;import&nbsp;confusion_matrix&nbsp;\n\nfrom&nbsp;sklearn.linear_model&nbsp;import&nbsp;LogisticRegression\n\nfrom&nbsp;sklearn&nbsp;import&nbsp;metrics\n\nimport&nbsp;seaborn&nbsp;as&nbsp;sns<\/pre>\n\n\n\n<h5 class=\"wp-block-heading\" id=\"collect-the-data\"><strong>Collect the Data<\/strong><\/h5>\n\n\n\n<p>I collected the data from <a href=\"https:\/\/www.kaggle.com\/mlg-ulb\/creditcardfraud\" rel=\"nofollow\">Kaggle dataset<\/a>.<\/p>\n\n\n\n<p><strong>Dataset description:<\/strong>&nbsp;<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>It contains 285,000 rows of data and 31 columns.<\/li>\n\n\n\n<li>&nbsp;The most important columns are<\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>&nbsp;Time,&nbsp;<\/li>\n\n\n\n<li>Amount,<\/li>\n\n\n\n<li>&nbsp;and Class (fraud or not fraud)<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-preformatted\">data_df=pd.read_csv('\/content\/creditcard&nbsp;2.csv')<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">data_df.head()<\/pre>\n\n\n\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" src=\"https:\/\/www.mygreatlearning.com\/academy\/career\/wp-content\/uploads\/2020\/07\/2020-07-08-10_47_12-Creditcard_fraud_detection_1.ipynb-Colaboratory-300x51.png\" alt=\"\" class=\"wp-image-34216\"\/><\/figure>\n\n\n\n<p><strong>Data understanding:<\/strong><\/p>\n\n\n\n<p><strong> This method is used to display basic statistical details like&nbsp;<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">data_df.describe()<\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Percentile,<\/li>\n\n\n\n<li>&nbsp;mean,&nbsp;<\/li>\n\n\n\n<li>std&nbsp;<\/li>\n\n\n\n<li>etc. of a data frame or a series of numeric values.<\/li>\n<\/ul>\n\n\n\n<p>For example, we only took the Amount, Time, and the Class columns.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>data_df.isna().any(): This method is used to Check the null values in the dataset.<\/strong><\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-preformatted\">data_df.isna().any()<\/pre>\n\n\n\n<p>False stands for we don\u2019t have any column with null values.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Display the percentage of total null values in the dataset:&nbsp;<\/strong><\/li>\n<\/ul>\n\n\n\n<p>Just to reconfirm that we don\u2019t have any null values in the dataset so that percentage calculation is done.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Find out the percentage of total not fraud transaction in the dataset:<\/strong><\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-preformatted\">data_df[\u2018Class\u2019] = 0 Not a fraud transaction\n\ndata_df[\u2018Class\u2019] = 1 Fraud transaction<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">nfcount=0\n\nnotFraud=data_df['Class']\n\nfor&nbsp;i&nbsp;in&nbsp;range(len(notFraud)):\n\n&nbsp;&nbsp;if&nbsp;notFraud[i]==0:\n\n&nbsp;&nbsp;&nbsp;&nbsp;nfcount=nfcount+1\n\nnfcount&nbsp;&nbsp;&nbsp;&nbsp;\n\nper_nf=(nfcount\/len(notFraud))*100\n\nprint('percentage&nbsp;of&nbsp;total&nbsp;not&nbsp;fraud&nbsp;transaction&nbsp;in&nbsp;the&nbsp;dataset:&nbsp;',per_nf)<\/pre>\n\n\n\n<p><strong>So in this data 99.82% of data are for normal transactions.<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Find out the percentage of total fraud transaction in the dataset:<\/strong><\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-preformatted\">data_df[\u2018Class\u2019] = 0 Not a fraud transaction\n\ndata_df[\u2018Class\u2019] = 1 Fraud transaction<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">fcount=0\n\nFraud=data_df['Class']\n\nfor&nbsp;i&nbsp;in&nbsp;range(len(Fraud)):\n\n&nbsp;&nbsp;if&nbsp;Fraud[i]==1:\n\n&nbsp;&nbsp;&nbsp;&nbsp;fcount=fcount+1\n\nfcount&nbsp;&nbsp;&nbsp;&nbsp;\n\nper_f=(fcount\/len(Fraud))*100\n\nprint('percentage&nbsp;of&nbsp;total&nbsp;fraud&nbsp;transaction&nbsp;in&nbsp;the&nbsp;dataset:&nbsp;',per_f)<\/pre>\n\n\n\n<p>0.172% of data holds the fraud transaction record.<\/p>\n\n\n\n<p><strong>Data Visualization:<\/strong><\/p>\n\n\n\n<p>Now we will visualize the data through the graph to understand more intuitively.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Plot Fraud transaction vs genuine transaction:<\/strong><\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-preformatted\">plt.title(\"Bar&nbsp;plot&nbsp;for&nbsp;Fraud&nbsp;VS&nbsp;Genuine&nbsp;transactions\")\n\nsns.barplot(x&nbsp;=&nbsp;'Fraud&nbsp;Transaction',&nbsp;y&nbsp;=&nbsp;'Genuine&nbsp;Transaction',&nbsp;data&nbsp;=&nbsp;plot_data,&nbsp;palette&nbsp;=&nbsp;'Blues',&nbsp;edgecolor&nbsp;=&nbsp;'w')<\/pre>\n\n\n\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" src=\"https:\/\/www.mygreatlearning.com\/academy\/career\/wp-content\/uploads\/2020\/07\/download-300x216.png\" alt=\"\" class=\"wp-image-34217\"\/><\/figure>\n\n\n\n<p>As per the graph we can say the ratio of genuine transactions are higher than fraud transactions.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Plot Amount Vs Time:<\/strong><\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-preformatted\">x=data_df['Amount']\n\ny=data_df['Time']\n\nplt.plot(x,&nbsp;y)&nbsp;\n\nplt.title('Time&nbsp;Vs&nbsp;amount')&nbsp;\n\n#sns.barplot(x&nbsp;=&nbsp;x,&nbsp;y&nbsp;=&nbsp;y,&nbsp;data&nbsp;=&nbsp;data,&nbsp;palette&nbsp;=&nbsp;'Blues',&nbsp;edgecolor&nbsp;=&nbsp;'w')<\/pre>\n\n\n\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" src=\"https:\/\/www.mygreatlearning.com\/academy\/career\/wp-content\/uploads\/2020\/07\/download-1-300x201.png\" alt=\"\" class=\"wp-image-34218\"\/><\/figure>\n\n\n\n<p>In this graph we try to plot the relation between Time and the amount.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Amount distribution curve:<\/strong><\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-preformatted\">plt.figure(figsize=(10,8),&nbsp;)\n\nplt.title('Amount&nbsp;Distribution')\n\nsns.distplot(data_df['Amount'],color='red');<\/pre>\n\n\n\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" src=\"https:\/\/www.mygreatlearning.com\/academy\/career\/wp-content\/uploads\/2020\/07\/download-2-1-300x240.png\" alt=\"\" class=\"wp-image-34220\"\/><\/figure>\n\n\n\n<p>From this amount distribution curve&nbsp; it is shown that the number high amount transactions are very low. So there is a high probability for huge transactions to be fraudulent .<\/p>\n\n\n\n<p><strong>Find the correlation between all the attributes in the Data:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">#&nbsp;Correlation&nbsp;matrix&nbsp;\n\ncorrelation_metrics&nbsp;=&nbsp;data_df.corr()&nbsp;\n\nfig&nbsp;=&nbsp;plt.figure(figsize&nbsp;=&nbsp;(14,&nbsp;9))&nbsp;\n\nsns.heatmap(correlation_metrics,&nbsp;vmax&nbsp;=&nbsp;.9,&nbsp;square&nbsp;=&nbsp;True)&nbsp;\n\nplt.show()<\/pre>\n\n\n<figure class=\"wp-block-image aligncenter zoomable\" data-full=\"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2021\/05\/iStock-643310564.jpg\"><img decoding=\"async\" src=\"https:\/\/www.mygreatlearning.com\/academy\/career\/wp-content\/uploads\/2020\/07\/download-3-1-300x256.png\" alt=\"\" class=\"wp-image-34222\"><\/figure>\n\n\n\n<p><strong>Correlation metrics help us to understand the core relation between two attributes.<\/strong><\/p>\n\n\n\n<p><strong>Find the outliers in the dataset:<\/strong><\/p>\n\n\n\n<p>An outlier is an observation that helps to find&nbsp; the abnormal behaviour in the dataset.<\/p>\n\n\n\n<p><strong>Modelling:<\/strong><\/p>\n\n\n\n<p><strong>To start with modelling First we need to split the dataset<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>80% \u2192 80% of the data will use to train the model<\/strong><\/li>\n\n\n\n<li><strong>20% \u2192 20% to validate the model<\/strong><\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-preformatted\">x=data_df.drop(['Class'],&nbsp;axis&nbsp;=&nbsp;1)#drop&nbsp;the&nbsp;target&nbsp;variable\n\ny=data_df['Class']\n\nxtrain,&nbsp;xtest,&nbsp;ytrain,&nbsp;ytest&nbsp;=&nbsp;train_test_split(x,&nbsp;y,&nbsp;test_size&nbsp;=&nbsp;0.2,&nbsp;random_state&nbsp;=&nbsp;42)<\/pre>\n\n\n\n<p><strong>First model we will start with Linear regression model:<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" src=\"https:\/\/www.mygreatlearning.com\/academy\/career\/wp-content\/uploads\/2020\/07\/kisspng-regression-analysis-simple-linear-regression-machi-5ba345d9e04635.9452952015374269059186-300x198.png\" alt=\"\" class=\"wp-image-34223\"\/><\/figure>\n\n\n\n<p><strong>What is a Linear regression model?<\/strong><\/p>\n\n\n\n<p>Linear regression is a type of supervised algorithm used for finding linear relationships between independent and dependent variables. Finds relationship between two or more continuous variables.<\/p>\n\n\n\n<p>This algorithm is mostly used in forecasting and predictions and shows the linear relationship between input and output variables, so it is called linear regression.<\/p>\n\n\n<figure class=\"wp-block-image aligncenter zoomable\" data-full=\"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2021\/05\/iStock-1169520520.jpg\"><img decoding=\"async\" src=\"https:\/\/www.mygreatlearning.com\/academy\/career\/wp-content\/uploads\/2020\/07\/kisspng-sticker-linearity-moon-line-sticker-moon-5b561c1d0fa7c6.0973621815323699490641-245x300.png\" alt=\"\" class=\"wp-image-34224\"><\/figure>\n\n\n\n<p><strong>Equation to solve linear regression problems:<\/strong><\/p>\n\n\n\n<p>Y= MX+C<\/p>\n\n\n\n<p>Where, y= Dependent variable<\/p>\n\n\n\n<p>X= independent variable<\/p>\n\n\n\n<p>M= slope<\/p>\n\n\n\n<p>C= intercept<\/p>\n\n\n\n<p>I hope we got a brief introduction about Linear regression now start implementing and training the model.<\/p>\n\n\n\n<p><strong>Here we call the linear regression method from scikit learn library and fit the model.<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">&nbsp;from&nbsp;sklearn.linear_model&nbsp;import&nbsp;LinearRegression\n\n&nbsp;linear&nbsp;=LinearRegression()\n\nlinear.fit(xtrain,&nbsp;ytrain)<\/pre>\n\n\n\n<p><strong>Now comes the prediction part:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">y_pred&nbsp;=&nbsp;linear.predict(xtest)\n\ntable=&nbsp;pd.DataFrame({\"Actual\":ytest,\"Predicted\":y_pred})\n\ntable<\/pre>\n\n\n\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" src=\"https:\/\/www.mygreatlearning.com\/academy\/career\/wp-content\/uploads\/2020\/07\/2020-07-08-11_13_44-Creditcard_fraud_detection_1.ipynb-Colaboratory-168x300.png\" alt=\"\" class=\"wp-image-34226\"\/><\/figure>\n\n\n\n<p>In this part we will provide test data to understand the model performance.<\/p>\n\n\n\n<p>As per, the accuracy score we can say our model\u2019s prediction is not good enough.<\/p>\n\n\n\n<p>So we can try some other algorithms to predict the fraud transaction:<\/p>\n\n\n\n<p><strong>Logistic Regression:<\/strong><\/p>\n\n\n\n<p><strong>What is Logistic Regression?<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" src=\"https:\/\/www.mygreatlearning.com\/academy\/career\/wp-content\/uploads\/2020\/07\/logistic-regression-300x300.png\" alt=\"\" class=\"wp-image-34225\"\/><\/figure>\n\n\n\n<p>Logistic regression is also a part of supervised learning classification algorithm. It is used to predict the probability of a target variable and the nature of target or dependent variable is discrete, so for the output there will be only two class will be present<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The dependent variable is binary in nature so that can be either 1 (stands for success\/yes) or 0 (stands for failure\/no).<\/li>\n\n\n\n<li>Logistic regression is also known as sigmoid function<\/li>\n\n\n\n<li><em>Sigmoid function = <\/em><em>1 \/ (1 + <\/em><em>e<\/em><em>^-<\/em><em>value<\/em><em>)<\/em><\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Implement and train the model:<\/strong><\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-preformatted\">logisticreg&nbsp;=&nbsp;LogisticRegression()\n\nlogisticreg.fit(xtrain,&nbsp;ytrain)<\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Predict the new data using Logistic Regression model:<\/strong><\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-preformatted\">y_pred&nbsp;=&nbsp;logisticreg.predict(xtest)<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">table=&nbsp;pd.DataFrame({\"Actual\":ytest,\"Predicted\":y_pred})\n\ntable<\/pre>\n\n\n\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" src=\"https:\/\/www.mygreatlearning.com\/academy\/career\/wp-content\/uploads\/2020\/07\/2020-07-08-11_17_36-Creditcard_fraud_detection_1.ipynb-Colaboratory-165x300.png\" alt=\"\" class=\"wp-image-34227\"\/><\/figure>\n\n\n\n<p>According to the&nbsp; accuracy score Logistic regression works pretty well because predicting fraud transactions is a classification problem.<\/p>\n\n\n\n<p>So, this is one method to predict the fraud transaction but also there are many methods and algorithms are there to solve this problem.<\/p>\n\n\n\n<p>In this article, we covered what is anomaly detection and how can we use machine learning to perform such tasks.Here is a chance for you to get a free course about machine learning , click the banner to know more<\/p>\n\n\n\n<div style=\"background-color: #efefef; border: 1px solid #000; padding: 8px;\"><p><b>Find  Machine Learning Course in Top Indian Cities<\/b><\/p> \n    <a href=\"https:\/\/www.mygreatlearning.com\/pg-program-machine-learning-course-in-chennai\" title=\" Machine Learning Course in Chennai\">Chennai<\/a> | \n    <a href=\"https:\/\/www.mygreatlearning.com\/pg-program-machine-learning-course-in-bangalore\" title=\" Machine Learning Course in Bangalore\">Bangalore<\/a> | \n    <a href=\"https:\/\/www.mygreatlearning.com\/pg-program-machine-learning-course-in-hyderabad\" title=\" Machine Learning Course in Hyderabad\">Hyderabad<\/a> | \n    <a href=\"https:\/\/www.mygreatlearning.com\/pg-program-machine-learning-course-in-pune\" title=\" Machine Learning Course in Pune\">Pune<\/a> | \n    <a href=\"https:\/\/www.mygreatlearning.com\/pg-program-machine-learning-course-in-mumbai\" title=\" Machine Learninge Course in Mumbai\">Mumbai<\/a> | \n    <a href=\"https:\/\/www.mygreatlearning.com\/pg-program-machine-learning-course-in-delhi-ncr\" title=\" Machine Learning Course in Delhi NCR\">Delhi NCR<\/a><\/div>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"our-machine-learning-courses\">Our Machine Learning Courses<\/h2>\n\n\n\n<p>Explore our Machine Learning and AI courses, designed for comprehensive learning and skill development.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th><strong>Program Name<\/strong><\/th><th><strong>Duration<\/strong><\/th><\/tr><tr><th><a href=\"https:\/\/professionalonline2.mit.edu\/no-code-artificial-intelligence-machine-learning-program\">MIT No code AI and Machine Learning Course<\/a><\/th><th>12 Weeks<\/th><\/tr><tr><th><a href=\"https:\/\/idss-gl.mit.edu\/mit-idss-data-science-machine-learning-online-program\">MIT Data Science and Machine Learning Course<\/a><\/th><th>12 Weeks<\/th><\/tr><tr><th><a href=\"https:\/\/www.mygreatlearning.com\/mit-data-science-and-machine-learning-program\">Data Science and Machine Learning Course<\/a><\/th><th>12 Weeks<\/th><\/tr><\/thead><\/table><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Anomaly detection is something similar to how our human brains are always trying to recognize something abnormal or out of the \u201cnormal\u201d or the \u201cusual stuff.\u201d Anomaly is basically&nbsp; that does not fit with the usual pattern. Abnormal growth of data or some pattern which is not similar with the other part of the data [&hellip;]<\/p>\n","protected":false},"author":41,"featured_media":17696,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_uag_custom_page_level_css":"","site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"set","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[2],"tags":[],"content_type":[],"class_list":["post-16749","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-artificial-intelligence"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.3 (Yoast SEO v27.3) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>How Machine Learning Can Enable Anomaly Detection? ML for Anomaly Detection<\/title>\n<meta name=\"description\" content=\"Machine Learning: Anomaly Detection is something similar to how our human brains are always trying to recognize something abnormal or out of the \u201cnormal\u201d or the \u201cusual stuff.\u201d\" \/>\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.mygreatlearning.com\/blog\/anomaly-detection-using-machine-learning\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Anomaly Detection using Machine Learning | How Machine Learning Can Enable Anomaly Detection?\" \/>\n<meta property=\"og:description\" content=\"Machine Learning: Anomaly Detection is something similar to how our human brains are always trying to recognize something abnormal or out of the \u201cnormal\u201d or the \u201cusual stuff.\u201d\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.mygreatlearning.com\/blog\/anomaly-detection-using-machine-learning\/\" \/>\n<meta property=\"og:site_name\" content=\"Great Learning Blog: Free Resources what Matters to shape your Career!\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/GreatLearningOfficial\/\" \/>\n<meta property=\"article:published_time\" content=\"2020-07-29T18:23:02+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-09-03T11:56:25+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/07\/iStock-990458084.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1270\" \/>\n\t<meta property=\"og:image:height\" content=\"826\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Great Learning Editorial Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/Great_Learning\" \/>\n<meta name=\"twitter:site\" content=\"@Great_Learning\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Great Learning Editorial Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"14 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/anomaly-detection-using-machine-learning\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/anomaly-detection-using-machine-learning\\\/\"},\"author\":{\"name\":\"Great Learning Editorial Team\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#\\\/schema\\\/person\\\/6f993d1be4c584a335951e836f2656ad\"},\"headline\":\"Anomaly Detection using Machine Learning | How Machine Learning Can Enable Anomaly Detection?\",\"datePublished\":\"2020-07-29T18:23:02+00:00\",\"dateModified\":\"2024-09-03T11:56:25+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/anomaly-detection-using-machine-learning\\\/\"},\"wordCount\":2637,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/anomaly-detection-using-machine-learning\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/07\\\/iStock-990458084.jpg\",\"articleSection\":[\"AI and Machine Learning\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/anomaly-detection-using-machine-learning\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/anomaly-detection-using-machine-learning\\\/\",\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/anomaly-detection-using-machine-learning\\\/\",\"name\":\"How Machine Learning Can Enable Anomaly Detection? ML for Anomaly Detection\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/anomaly-detection-using-machine-learning\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/anomaly-detection-using-machine-learning\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/07\\\/iStock-990458084.jpg\",\"datePublished\":\"2020-07-29T18:23:02+00:00\",\"dateModified\":\"2024-09-03T11:56:25+00:00\",\"description\":\"Machine Learning: Anomaly Detection is something similar to how our human brains are always trying to recognize something abnormal or out of the \u201cnormal\u201d or the \u201cusual stuff.\u201d\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/anomaly-detection-using-machine-learning\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/anomaly-detection-using-machine-learning\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/anomaly-detection-using-machine-learning\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/07\\\/iStock-990458084.jpg\",\"contentUrl\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/07\\\/iStock-990458084.jpg\",\"width\":1270,\"height\":826,\"caption\":\"anomaly detection\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/anomaly-detection-using-machine-learning\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Blog\",\"item\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"AI and Machine Learning\",\"item\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/artificial-intelligence\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Anomaly Detection using Machine Learning | How Machine Learning Can Enable Anomaly Detection?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/\",\"name\":\"Great Learning Blog\",\"description\":\"Learn, Upskill &amp; Career Development Guide and Resources\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#organization\"},\"alternateName\":\"Great Learning\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#organization\",\"name\":\"Great Learning\",\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/GL-Logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/GL-Logo.jpg\",\"width\":900,\"height\":900,\"caption\":\"Great Learning\"},\"image\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/GreatLearningOfficial\\\/\",\"https:\\\/\\\/x.com\\\/Great_Learning\",\"https:\\\/\\\/www.instagram.com\\\/greatlearningofficial\\\/\",\"https:\\\/\\\/www.linkedin.com\\\/school\\\/great-learning\\\/\",\"https:\\\/\\\/in.pinterest.com\\\/greatlearning12\\\/\",\"https:\\\/\\\/www.youtube.com\\\/user\\\/beaconelearning\\\/\"],\"description\":\"Great Learning is a leading global ed-tech company for professional training and higher education. It offers comprehensive, industry-relevant, hands-on learning programs across various business, technology, and interdisciplinary domains driving the digital economy. These programs are developed and offered in collaboration with the world's foremost academic institutions.\",\"email\":\"info@mygreatlearning.com\",\"legalName\":\"Great Learning Education Services Pvt. Ltd\",\"foundingDate\":\"2013-11-29\",\"numberOfEmployees\":{\"@type\":\"QuantitativeValue\",\"minValue\":\"1001\",\"maxValue\":\"5000\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#\\\/schema\\\/person\\\/6f993d1be4c584a335951e836f2656ad\",\"name\":\"Great Learning Editorial Team\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/02\\\/unnamed.webp\",\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/02\\\/unnamed.webp\",\"contentUrl\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/02\\\/unnamed.webp\",\"caption\":\"Great Learning Editorial Team\"},\"description\":\"The Great Learning Editorial Staff includes a dynamic team of subject matter experts, instructors, and education professionals who combine their deep industry knowledge with innovative teaching methods. Their mission is to provide learners with the skills and insights needed to excel in their careers, whether through upskilling, reskilling, or transitioning into new fields.\",\"sameAs\":[\"https:\\\/\\\/www.mygreatlearning.com\\\/\",\"https:\\\/\\\/in.linkedin.com\\\/school\\\/great-learning\\\/\",\"https:\\\/\\\/x.com\\\/https:\\\/\\\/twitter.com\\\/Great_Learning\",\"https:\\\/\\\/www.youtube.com\\\/channel\\\/UCObs0kLIrDjX2LLSybqNaEA\"],\"award\":[\"Best EdTech Company of the Year 2024\",\"Education Economictimes Outstanding Education\\\/Edtech Solution Provider of the Year 2024\",\"Leading E-learning Platform 2024\"],\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/author\\\/greatlearning\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"How Machine Learning Can Enable Anomaly Detection? ML for Anomaly Detection","description":"Machine Learning: Anomaly Detection is something similar to how our human brains are always trying to recognize something abnormal or out of the \u201cnormal\u201d or the \u201cusual stuff.\u201d","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.mygreatlearning.com\/blog\/anomaly-detection-using-machine-learning\/","og_locale":"en_US","og_type":"article","og_title":"Anomaly Detection using Machine Learning | How Machine Learning Can Enable Anomaly Detection?","og_description":"Machine Learning: Anomaly Detection is something similar to how our human brains are always trying to recognize something abnormal or out of the \u201cnormal\u201d or the \u201cusual stuff.\u201d","og_url":"https:\/\/www.mygreatlearning.com\/blog\/anomaly-detection-using-machine-learning\/","og_site_name":"Great Learning Blog: Free Resources what Matters to shape your Career!","article_publisher":"https:\/\/www.facebook.com\/GreatLearningOfficial\/","article_published_time":"2020-07-29T18:23:02+00:00","article_modified_time":"2024-09-03T11:56:25+00:00","og_image":[{"width":1270,"height":826,"url":"http:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/07\/iStock-990458084.jpg","type":"image\/jpeg"}],"author":"Great Learning Editorial Team","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/Great_Learning","twitter_site":"@Great_Learning","twitter_misc":{"Written by":"Great Learning Editorial Team","Est. reading time":"14 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.mygreatlearning.com\/blog\/anomaly-detection-using-machine-learning\/#article","isPartOf":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/anomaly-detection-using-machine-learning\/"},"author":{"name":"Great Learning Editorial Team","@id":"https:\/\/www.mygreatlearning.com\/blog\/#\/schema\/person\/6f993d1be4c584a335951e836f2656ad"},"headline":"Anomaly Detection using Machine Learning | How Machine Learning Can Enable Anomaly Detection?","datePublished":"2020-07-29T18:23:02+00:00","dateModified":"2024-09-03T11:56:25+00:00","mainEntityOfPage":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/anomaly-detection-using-machine-learning\/"},"wordCount":2637,"commentCount":0,"publisher":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/anomaly-detection-using-machine-learning\/#primaryimage"},"thumbnailUrl":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/07\/iStock-990458084.jpg","articleSection":["AI and Machine Learning"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.mygreatlearning.com\/blog\/anomaly-detection-using-machine-learning\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.mygreatlearning.com\/blog\/anomaly-detection-using-machine-learning\/","url":"https:\/\/www.mygreatlearning.com\/blog\/anomaly-detection-using-machine-learning\/","name":"How Machine Learning Can Enable Anomaly Detection? ML for Anomaly Detection","isPartOf":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/anomaly-detection-using-machine-learning\/#primaryimage"},"image":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/anomaly-detection-using-machine-learning\/#primaryimage"},"thumbnailUrl":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/07\/iStock-990458084.jpg","datePublished":"2020-07-29T18:23:02+00:00","dateModified":"2024-09-03T11:56:25+00:00","description":"Machine Learning: Anomaly Detection is something similar to how our human brains are always trying to recognize something abnormal or out of the \u201cnormal\u201d or the \u201cusual stuff.\u201d","breadcrumb":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/anomaly-detection-using-machine-learning\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.mygreatlearning.com\/blog\/anomaly-detection-using-machine-learning\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.mygreatlearning.com\/blog\/anomaly-detection-using-machine-learning\/#primaryimage","url":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/07\/iStock-990458084.jpg","contentUrl":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/07\/iStock-990458084.jpg","width":1270,"height":826,"caption":"anomaly detection"},{"@type":"BreadcrumbList","@id":"https:\/\/www.mygreatlearning.com\/blog\/anomaly-detection-using-machine-learning\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog","item":"https:\/\/www.mygreatlearning.com\/blog\/"},{"@type":"ListItem","position":2,"name":"AI and Machine Learning","item":"https:\/\/www.mygreatlearning.com\/blog\/artificial-intelligence\/"},{"@type":"ListItem","position":3,"name":"Anomaly Detection using Machine Learning | How Machine Learning Can Enable Anomaly Detection?"}]},{"@type":"WebSite","@id":"https:\/\/www.mygreatlearning.com\/blog\/#website","url":"https:\/\/www.mygreatlearning.com\/blog\/","name":"Great Learning Blog","description":"Learn, Upskill &amp; Career Development Guide and Resources","publisher":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/#organization"},"alternateName":"Great Learning","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.mygreatlearning.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.mygreatlearning.com\/blog\/#organization","name":"Great Learning","url":"https:\/\/www.mygreatlearning.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.mygreatlearning.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/06\/GL-Logo.jpg","contentUrl":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/06\/GL-Logo.jpg","width":900,"height":900,"caption":"Great Learning"},"image":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/GreatLearningOfficial\/","https:\/\/x.com\/Great_Learning","https:\/\/www.instagram.com\/greatlearningofficial\/","https:\/\/www.linkedin.com\/school\/great-learning\/","https:\/\/in.pinterest.com\/greatlearning12\/","https:\/\/www.youtube.com\/user\/beaconelearning\/"],"description":"Great Learning is a leading global ed-tech company for professional training and higher education. It offers comprehensive, industry-relevant, hands-on learning programs across various business, technology, and interdisciplinary domains driving the digital economy. These programs are developed and offered in collaboration with the world's foremost academic institutions.","email":"info@mygreatlearning.com","legalName":"Great Learning Education Services Pvt. Ltd","foundingDate":"2013-11-29","numberOfEmployees":{"@type":"QuantitativeValue","minValue":"1001","maxValue":"5000"}},{"@type":"Person","@id":"https:\/\/www.mygreatlearning.com\/blog\/#\/schema\/person\/6f993d1be4c584a335951e836f2656ad","name":"Great Learning Editorial Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/02\/unnamed.webp","url":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/02\/unnamed.webp","contentUrl":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/02\/unnamed.webp","caption":"Great Learning Editorial Team"},"description":"The Great Learning Editorial Staff includes a dynamic team of subject matter experts, instructors, and education professionals who combine their deep industry knowledge with innovative teaching methods. Their mission is to provide learners with the skills and insights needed to excel in their careers, whether through upskilling, reskilling, or transitioning into new fields.","sameAs":["https:\/\/www.mygreatlearning.com\/","https:\/\/in.linkedin.com\/school\/great-learning\/","https:\/\/x.com\/https:\/\/twitter.com\/Great_Learning","https:\/\/www.youtube.com\/channel\/UCObs0kLIrDjX2LLSybqNaEA"],"award":["Best EdTech Company of the Year 2024","Education Economictimes Outstanding Education\/Edtech Solution Provider of the Year 2024","Leading E-learning Platform 2024"],"url":"https:\/\/www.mygreatlearning.com\/blog\/author\/greatlearning\/"}]}},"uagb_featured_image_src":{"full":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/07\/iStock-990458084.jpg",1270,826,false],"thumbnail":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/07\/iStock-990458084-150x150.jpg",150,150,true],"medium":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/07\/iStock-990458084-300x195.jpg",300,195,true],"medium_large":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/07\/iStock-990458084-768x500.jpg",768,500,true],"large":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/07\/iStock-990458084-1024x666.jpg",1024,666,true],"1536x1536":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/07\/iStock-990458084.jpg",1270,826,false],"2048x2048":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/07\/iStock-990458084.jpg",1270,826,false],"web-stories-poster-portrait":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/07\/iStock-990458084.jpg",640,416,false],"web-stories-publisher-logo":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/07\/iStock-990458084.jpg",96,62,false],"web-stories-thumbnail":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/07\/iStock-990458084.jpg",150,98,false]},"uagb_author_info":{"display_name":"Great Learning Editorial Team","author_link":"https:\/\/www.mygreatlearning.com\/blog\/author\/greatlearning\/"},"uagb_comment_info":0,"uagb_excerpt":"Anomaly detection is something similar to how our human brains are always trying to recognize something abnormal or out of the \u201cnormal\u201d or the \u201cusual stuff.\u201d Anomaly is basically&nbsp; that does not fit with the usual pattern. Abnormal growth of data or some pattern which is not similar with the other part of the data&hellip;","_links":{"self":[{"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/posts\/16749","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/users\/41"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/comments?post=16749"}],"version-history":[{"count":20,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/posts\/16749\/revisions"}],"predecessor-version":[{"id":110505,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/posts\/16749\/revisions\/110505"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/media\/17696"}],"wp:attachment":[{"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/media?parent=16749"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/categories?post=16749"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/tags?post=16749"},{"taxonomy":"content_type","embeddable":true,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/content_type?post=16749"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}