{"id":7796,"date":"2023-10-04T11:18:06","date_gmt":"2023-10-04T19:18:06","guid":{"rendered":"https:\/\/live-cometml.pantheonsite.io\/?p=7796"},"modified":"2025-04-24T17:06:02","modified_gmt":"2025-04-24T17:06:02","slug":"machine-learning-for-classifying-social-media-ads","status":"publish","type":"post","link":"https:\/\/www.comet.com\/site\/blog\/machine-learning-for-classifying-social-media-ads\/","title":{"rendered":"Machine Learning for Classifying Social Media Ads"},"content":{"rendered":"\n<link rel=\"canonical\" href=\"https:\/\/www.comet.com\/site\/blog\/machine-learning-for-classifying-social-media-ads\">\n\n\n\n<div class=\"fh fi fj fk fl\">\n<div class=\"ab ca\">\n<div class=\"ch bg et eu ev ew\">\n<figure class=\"lx ly lz ma mb mc lu lv paragraph-image\">\n<div class=\"md me eb mf bg mg\" tabindex=\"0\" role=\"button\">\n<figure><img loading=\"lazy\" decoding=\"async\" class=\"bg mh mi c\" role=\"presentation\" src=\"https:\/\/miro.medium.com\/v2\/resize:fit:700\/1*RNNS9wYIOj4Cb4gkBbiTow.jpeg\" alt=\"\" width=\"700\" height=\"467\"><\/figure><div class=\"lu lv lw\"><picture><\/picture><\/div>\n<\/div><figcaption class=\"mj mk ml lu lv mm mn be b bf z dv\" data-selectable-paragraph=\"\">image source: <a class=\"af mo\" href=\"https:\/\/pixabay.com\/photos\/social-media-facebook-twitter-1795578\/\" target=\"_blank\" rel=\"noopener ugc nofollow\">Pixabay<\/a><\/figcaption><\/figure>\n<p id=\"ea87\" class=\"pw-post-body-paragraph mp mq fo be b mr ms mt mu mv mw mx my mz na nb nc nd ne nf ng nh ni nj nk nl fh bj\" data-selectable-paragraph=\"\">Social media first served as a space for individuals, but companies have since seen the potential. Top social media sites are becoming effective marketing tools, perhaps taking the place of more conventional options like TV ads or brochures. The internet is a key marketing tool that may be utilized to increase brand awareness, draw in clients, and establish credibility.<\/p>\n<p id=\"77ed\" class=\"pw-post-body-paragraph mp mq fo be b mr ms mt mu mv mw mx my mz na nb nc nd ne nf ng nh ni nj nk nl fh bj\" data-selectable-paragraph=\"\">Nowadays, practically every company around the globe must include social media marketing in its advertising plans. <a class=\"af mo\" href=\"https:\/\/www.zettasphere.com\/mind-boggling-stats-for-1-second-of-internet-activity\/\" target=\"_blank\" rel=\"noopener ugc nofollow\">On Facebook, there are <strong class=\"be nm\">54,000 <\/strong>new posts published every second, and on Twitter, there are over <strong class=\"be nm\">5,000<\/strong>.<\/a> Every time a new social network appears, marketers have a new opportunity to raise awareness of their brands.<\/p>\n<p id=\"271a\" class=\"pw-post-body-paragraph mp mq fo be b mr ms mt mu mv mw mx my mz na nb nc nd ne nf ng nh ni nj nk nl fh bj\" data-selectable-paragraph=\"\">Social media is used by social scientists and business professionals all around the world to study how individuals interact with their environment. It all comes down to analyzing the ads\/commercials to determine whether or not your target market will really purchase the goods. This is a fantastic application of <strong class=\"be nm\">data science in marketing.<\/strong><\/p>\n<p id=\"72ad\" class=\"pw-post-body-paragraph mp mq fo be b mr ms mt mu mv mw mx my mz na nb nc nd ne nf ng nh ni nj nk nl fh bj\" data-selectable-paragraph=\"\">So this article is for you if you want to discover how to categorize your target audience by analyzing social media marketing. I\u2019ll guide you through the process of classifying social media ads using machine learning and Python.<\/p>\n<h1 id=\"7b2b\" class=\"nn no fo be np nq nr ns nt nu nv nw nx ny nz oa ob oc od oe of og oh oi oj ok bj\" data-selectable-paragraph=\"\">Social media ads<\/h1>\n<p id=\"bc47\" class=\"pw-post-body-paragraph mp mq fo be b mr ol mt mu mv om mx my mz on nb nc nd oo nf ng nh op nj nk nl fh bj\" data-selectable-paragraph=\"\">Through social networks like Facebook, YouTube, Twitter, TikTok, LinkedIn, and Instagram, sponsored adverts are shared with your target market as part of social media advertising, a type of online marketing. A simple and effective way to interact with your audience and assist your marketing goals is through social media advertising. These adverts provide a variety of lucrative possibilities and are a great way to support your efforts in digital marketing. There are many different social media ad forms, including banner ads, video ads, story ads, and messenger ads.<\/p>\n<p id=\"fe1c\" class=\"pw-post-body-paragraph mp mq fo be b mr ms mt mu mv mw mx my mz na nb nc nd ne nf ng nh ni nj nk nl fh bj\" data-selectable-paragraph=\"\">You can optimize your social media ads by tracking ad progress, making use of organic postings, creating mobile-friendly ads, and recognizing the people you want to reach.<\/p>\n<h1 id=\"17b3\" class=\"nn no fo be np nq nr ns nt nu nv nw nx ny nz oa ob oc od oe of og oh oi oj ok bj\" data-selectable-paragraph=\"\">Benefits of using machine learning in social media ads<\/h1>\n<p id=\"7880\" class=\"pw-post-body-paragraph mp mq fo be b mr ol mt mu mv om mx my mz on nb nc nd oo nf ng nh op nj nk nl fh bj\" data-selectable-paragraph=\"\"><strong class=\"be nm\">Sentiment analysis<\/strong>: Sentiment analysis is the practice of looking into audience remarks to find out if they have neutral, positive, or negative associations. The findings assist companies in understanding how consumers feel about their goods and services. Customer care representatives should use sentiment analysis and respond appropriately. Of course, as the audience grows, manual sentiment analysis will become a time-consuming process, therefore using machine learning may help.<\/p>\n<p id=\"603b\" class=\"pw-post-body-paragraph mp mq fo be b mr ms mt mu mv mw mx my mz na nb nc nd ne nf ng nh ni nj nk nl fh bj\" data-selectable-paragraph=\"\"><strong class=\"be nm\">Image recognition and processing: <\/strong>In social media marketing, accumulating mentions of your brand, products, and services is beneficial. A very significant usage of machine learning is image processing, which may be used to identify pictures. Through social media networks, you may teach computers to identify a logo or even certain types of products in order to understand your reach and see customer interactions.<\/p>\n<p id=\"cd91\" class=\"pw-post-body-paragraph mp mq fo be b mr ms mt mu mv mw mx my mz na nb nc nd ne nf ng nh ni nj nk nl fh bj\" data-selectable-paragraph=\"\"><strong class=\"be nm\">Chatbots: <\/strong>An application of AI that simulates genuine interactions, they can be sent through a third-party messaging service like Facebook Messenger, Twitter, or Instagram\u2019s direct messaging, or they can be integrated into websites like online retailers. <a class=\"af mo\" href=\"https:\/\/startupbonsai.com\/chatbot-statistics\/\" target=\"_blank\" rel=\"noopener ugc nofollow\">Chatbots are more likely to boost consumer satisfaction for companies whose clientele is typically young.<\/a><\/p>\n<p id=\"4673\" class=\"pw-post-body-paragraph mp mq fo be b mr ms mt mu mv mw mx my mz na nb nc nd ne nf ng nh ni nj nk nl fh bj\" data-selectable-paragraph=\"\"><strong class=\"be nm\">Monitoring Mentions: <\/strong>You should show up as a digital marketer anywhere your specialized keywords are discussed. Without using machine learning, this is not feasible. If you operate in the food sector, for instance, you might train the machine learning model to detect each time phrases associated with food are stated. You can then reply to such social media postings. There are a few tools that already doing this such as <a class=\"af mo\" href=\"https:\/\/www.brandwatch.com\/\" target=\"_blank\" rel=\"noopener ugc nofollow\">Bandwatch<\/a>, <a class=\"af mo\" href=\"https:\/\/www.sendible.com\/\" target=\"_blank\" rel=\"noopener ugc nofollow\">Sendible<\/a>, <a class=\"af mo\" href=\"https:\/\/brand24.com\/\" target=\"_blank\" rel=\"noopener ugc nofollow\">Brand24<\/a>, <a class=\"af mo\" href=\"https:\/\/www.talkwalker.com\/\" target=\"_blank\" rel=\"noopener ugc nofollow\">Talkwalker<\/a>, and lots more.<\/p>\n<h1 id=\"1b04\" class=\"nn no fo be np nq nr ns nt nu nv nw nx ny nz oa ob oc od oe of og oh oi oj ok bj\" data-selectable-paragraph=\"\">Social media ads classification<\/h1>\n<p id=\"e2a1\" class=\"pw-post-body-paragraph mp mq fo be b mr ol mt mu mv om mx my mz on nb nc nd oo nf ng nh op nj nk nl fh bj\" data-selectable-paragraph=\"\">The products you are selling aren\u2019t perfect for everyone. For instance, a person in college (teens and 20s) will spend more on books, courses, and other educational related materials compared to someone who is not in college (mostly in their 30s and 40s). A high-earner may afford to spend more money on luxury items than a person with a low income.<\/p>\n<p id=\"be68\" class=\"pw-post-body-paragraph mp mq fo be b mr ms mt mu mv mw mx my mz na nb nc nd ne nf ng nh ni nj nk nl fh bj\" data-selectable-paragraph=\"\">So, by categorizing their social media adverts, a company may ascertain if a customer would purchase their goods or not. We will now demonstrate how you can achieve this using a Decision Tree classifier.<\/p>\n<h2 id=\"c4bb\" class=\"oq no fo be np or os ot nt ou ov ow nx mz ox oy oz nd pa pb pc nh pd pe pf pg bj\" data-selectable-paragraph=\"\">Installation and importing of the required libraries<\/h2>\n<pre class=\"ph pi pj pk pl pm pn po pp ax pq bj\"><span id=\"44ae\" class=\"oq no fo pn b ho pr ps l ie pt\" data-selectable-paragraph=\"\">import numpy\nimport pandas as pd\nimport matplotlib.pyplot as plt\nimport seaborn as sns\nimport numpy as np<\/span><span id=\"47cf\" class=\"oq no fo pn b ho pu ps l ie pt\" data-selectable-paragraph=\"\">from sklearn.model_selection import train_test_split\nfrom sklearn.tree import DecisionTreeClassifier\nfrom sklearn.metrics import classification_report<\/span><\/pre>\n<h2 id=\"5127\" class=\"oq no fo be np or os ot nt ou ov ow nx mz ox oy oz nd pa pb pc nh pd pe pf pg bj\" data-selectable-paragraph=\"\">Dataset<\/h2>\n<p id=\"9def\" class=\"pw-post-body-paragraph mp mq fo be b mr ol mt mu mv om mx my mz on nb nc nd oo nf ng nh op nj nk nl fh bj\" data-selectable-paragraph=\"\">The <a class=\"af mo\" href=\"https:\/\/www.kaggle.com\/datasets\/d4rklucif3r\/social-network-ads\" target=\"_blank\" rel=\"noopener ugc nofollow\">dataset<\/a> we are using for the purpose of classifying social media ads is acquired from Kaggle; it indicates whether or not a person of a certain age and a given estimated wage or income buys the product.<\/p>\n<pre class=\"ph pi pj pk pl pm pn po pp ax pq bj\"><span id=\"bd25\" class=\"oq no fo pn b ho pr ps l ie pt\" data-selectable-paragraph=\"\">df = pd.read_csv(\"Social_Network_Ads.csv\")\ndf.head()<\/span><\/pre>\n<figure class=\"ph pi pj pk pl mc lu lv paragraph-image\">\n<div class=\"md me eb mf bg mg\" tabindex=\"0\" role=\"button\">\n<figure><img loading=\"lazy\" decoding=\"async\" class=\"bg mh mi c\" role=\"presentation\" src=\"https:\/\/miro.medium.com\/v2\/resize:fit:700\/1*_JnbGQG_xuaJB_-XZ4yWcA.png\" alt=\"\" width=\"700\" height=\"155\"><\/figure><div class=\"lu lv pv\"><picture><source srcset=\"https:\/\/miro.medium.com\/v2\/resize:fit:640\/format:webp\/1*_JnbGQG_xuaJB_-XZ4yWcA.png 640w, https:\/\/miro.medium.com\/v2\/resize:fit:720\/format:webp\/1*_JnbGQG_xuaJB_-XZ4yWcA.png 720w, https:\/\/miro.medium.com\/v2\/resize:fit:750\/format:webp\/1*_JnbGQG_xuaJB_-XZ4yWcA.png 750w, https:\/\/miro.medium.com\/v2\/resize:fit:786\/format:webp\/1*_JnbGQG_xuaJB_-XZ4yWcA.png 786w, https:\/\/miro.medium.com\/v2\/resize:fit:828\/format:webp\/1*_JnbGQG_xuaJB_-XZ4yWcA.png 828w, https:\/\/miro.medium.com\/v2\/resize:fit:1100\/format:webp\/1*_JnbGQG_xuaJB_-XZ4yWcA.png 1100w, https:\/\/miro.medium.com\/v2\/resize:fit:1400\/format:webp\/1*_JnbGQG_xuaJB_-XZ4yWcA.png 1400w\" type=\"image\/webp\" sizes=\"(min-resolution: 4dppx) and (max-width: 700px) 50vw, (-webkit-min-device-pixel-ratio: 4) and (max-width: 700px) 50vw, (min-resolution: 3dppx) and (max-width: 700px) 67vw, (-webkit-min-device-pixel-ratio: 3) and (max-width: 700px) 65vw, (min-resolution: 2.5dppx) and (max-width: 700px) 80vw, (-webkit-min-device-pixel-ratio: 2.5) and (max-width: 700px) 80vw, (min-resolution: 2dppx) and (max-width: 700px) 100vw, (-webkit-min-device-pixel-ratio: 2) and (max-width: 700px) 100vw, 700px\"><source srcset=\"https:\/\/miro.medium.com\/v2\/resize:fit:640\/1*_JnbGQG_xuaJB_-XZ4yWcA.png 640w, https:\/\/miro.medium.com\/v2\/resize:fit:720\/1*_JnbGQG_xuaJB_-XZ4yWcA.png 720w, https:\/\/miro.medium.com\/v2\/resize:fit:750\/1*_JnbGQG_xuaJB_-XZ4yWcA.png 750w, https:\/\/miro.medium.com\/v2\/resize:fit:786\/1*_JnbGQG_xuaJB_-XZ4yWcA.png 786w, https:\/\/miro.medium.com\/v2\/resize:fit:828\/1*_JnbGQG_xuaJB_-XZ4yWcA.png 828w, https:\/\/miro.medium.com\/v2\/resize:fit:1100\/1*_JnbGQG_xuaJB_-XZ4yWcA.png 1100w, https:\/\/miro.medium.com\/v2\/resize:fit:1400\/1*_JnbGQG_xuaJB_-XZ4yWcA.png 1400w\" sizes=\"(min-resolution: 4dppx) and (max-width: 700px) 50vw, (-webkit-min-device-pixel-ratio: 4) and (max-width: 700px) 50vw, (min-resolution: 3dppx) and (max-width: 700px) 67vw, (-webkit-min-device-pixel-ratio: 3) and (max-width: 700px) 65vw, (min-resolution: 2.5dppx) and (max-width: 700px) 80vw, (-webkit-min-device-pixel-ratio: 2.5) and (max-width: 700px) 80vw, (min-resolution: 2dppx) and (max-width: 700px) 100vw, (-webkit-min-device-pixel-ratio: 2) and (max-width: 700px) 100vw, 700px\" data-testid=\"og\"><\/picture><\/div>\n<\/div>\n<figcaption class=\"mj mk ml lu lv mm mn be b bf z dv\" data-selectable-paragraph=\"\">social network ads dataset.<\/figcaption>\n<\/figure>\n<p id=\"f046\" class=\"pw-post-body-paragraph mp mq fo be b mr ms mt mu mv mw mx my mz na nb nc nd ne nf ng nh ni nj nk nl fh bj\" data-selectable-paragraph=\"\">Let\u2019s examine some of the data\u2019s insights to know if we will need to modify the dataset in any way. I went through the dataset to check for null values that could hurt us in the future.<\/p>\n<pre class=\"ph pi pj pk pl pm pn po pp ax pq bj\"><span id=\"c6d7\" class=\"oq no fo pn b ho pr ps l ie pt\" data-selectable-paragraph=\"\">df.describe()\ndf.isnull().sum()<\/span><\/pre>\n<figure class=\"ph pi pj pk pl mc lu lv paragraph-image\">\n<div class=\"md me eb mf bg mg\" tabindex=\"0\" role=\"button\">\n<figure><img loading=\"lazy\" decoding=\"async\" class=\"bg mh mi c\" role=\"presentation\" src=\"https:\/\/miro.medium.com\/v2\/resize:fit:700\/1*DR3OqNuFD0J1ZdBYhAf8Og.png\" alt=\"\" width=\"700\" height=\"271\"><\/figure><div class=\"lu lv pv\"><picture><source srcset=\"https:\/\/miro.medium.com\/v2\/resize:fit:640\/format:webp\/1*DR3OqNuFD0J1ZdBYhAf8Og.png 640w, https:\/\/miro.medium.com\/v2\/resize:fit:720\/format:webp\/1*DR3OqNuFD0J1ZdBYhAf8Og.png 720w, https:\/\/miro.medium.com\/v2\/resize:fit:750\/format:webp\/1*DR3OqNuFD0J1ZdBYhAf8Og.png 750w, https:\/\/miro.medium.com\/v2\/resize:fit:786\/format:webp\/1*DR3OqNuFD0J1ZdBYhAf8Og.png 786w, https:\/\/miro.medium.com\/v2\/resize:fit:828\/format:webp\/1*DR3OqNuFD0J1ZdBYhAf8Og.png 828w, https:\/\/miro.medium.com\/v2\/resize:fit:1100\/format:webp\/1*DR3OqNuFD0J1ZdBYhAf8Og.png 1100w, https:\/\/miro.medium.com\/v2\/resize:fit:1400\/format:webp\/1*DR3OqNuFD0J1ZdBYhAf8Og.png 1400w\" type=\"image\/webp\" sizes=\"(min-resolution: 4dppx) and (max-width: 700px) 50vw, (-webkit-min-device-pixel-ratio: 4) and (max-width: 700px) 50vw, (min-resolution: 3dppx) and (max-width: 700px) 67vw, (-webkit-min-device-pixel-ratio: 3) and (max-width: 700px) 65vw, (min-resolution: 2.5dppx) and (max-width: 700px) 80vw, (-webkit-min-device-pixel-ratio: 2.5) and (max-width: 700px) 80vw, (min-resolution: 2dppx) and (max-width: 700px) 100vw, (-webkit-min-device-pixel-ratio: 2) and (max-width: 700px) 100vw, 700px\"><source srcset=\"https:\/\/miro.medium.com\/v2\/resize:fit:640\/1*DR3OqNuFD0J1ZdBYhAf8Og.png 640w, https:\/\/miro.medium.com\/v2\/resize:fit:720\/1*DR3OqNuFD0J1ZdBYhAf8Og.png 720w, https:\/\/miro.medium.com\/v2\/resize:fit:750\/1*DR3OqNuFD0J1ZdBYhAf8Og.png 750w, https:\/\/miro.medium.com\/v2\/resize:fit:786\/1*DR3OqNuFD0J1ZdBYhAf8Og.png 786w, https:\/\/miro.medium.com\/v2\/resize:fit:828\/1*DR3OqNuFD0J1ZdBYhAf8Og.png 828w, https:\/\/miro.medium.com\/v2\/resize:fit:1100\/1*DR3OqNuFD0J1ZdBYhAf8Og.png 1100w, https:\/\/miro.medium.com\/v2\/resize:fit:1400\/1*DR3OqNuFD0J1ZdBYhAf8Og.png 1400w\" sizes=\"(min-resolution: 4dppx) and (max-width: 700px) 50vw, (-webkit-min-device-pixel-ratio: 4) and (max-width: 700px) 50vw, (min-resolution: 3dppx) and (max-width: 700px) 67vw, (-webkit-min-device-pixel-ratio: 3) and (max-width: 700px) 65vw, (min-resolution: 2.5dppx) and (max-width: 700px) 80vw, (-webkit-min-device-pixel-ratio: 2.5) and (max-width: 700px) 80vw, (min-resolution: 2dppx) and (max-width: 700px) 100vw, (-webkit-min-device-pixel-ratio: 2) and (max-width: 700px) 100vw, 700px\" data-testid=\"og\"><\/picture><\/div>\n<\/div>\n<\/figure>\n<p id=\"2231\" class=\"pw-post-body-paragraph mp mq fo be b mr ms mt mu mv mw mx my mz na nb nc nd ne nf ng nh ni nj nk nl fh bj\" data-selectable-paragraph=\"\">As you can see, everything looks good and there are no null values in our dataset.<\/p>\n<\/div>\n<\/div>\n<\/div>\n\n\n\n<div class=\"fh fi fj fk fl\">\n<div class=\"ab ca\">\n<div class=\"ch bg et eu ev ew\">\n<blockquote class=\"qe\"><p id=\"e1cf\" class=\"qf qg fo be qh qi qj qk ql qm qn nl dv\" data-selectable-paragraph=\"\">Did you know we\u2019re on <a class=\"af mo\" href=\"https:\/\/www.youtube.com\/channel\/UCmN63HKvfXSCS-UwVwmK8Hw\" target=\"_blank\" rel=\"noopener ugc nofollow\">YouTube<\/a>? Watch for industry interviews, new product releases, and more!<\/p><\/blockquote>\n<\/div>\n<\/div>\n<\/div>\n\n\n\n<div class=\"fh fi fj fk fl\">\n<div class=\"ab ca\">\n<div class=\"ch bg et eu ev ew\">\n<h2 id=\"f4b3\" class=\"oq no fo be np or os ot nt ou ov ow nx mz ox oy oz nd pa pb pc nh pd pe pf pg bj\" data-selectable-paragraph=\"\">Dataset trends<\/h2>\n<p id=\"f539\" class=\"pw-post-body-paragraph mp mq fo be b mr ol mt mu mv om mx my mz on nb nc nd oo nf ng nh op nj nk nl fh bj\" data-selectable-paragraph=\"\">Let\u2019s now look into a few key trends in the dataset. The first thing I want to look at is the age range of people who responded to social media marketing and bought the products.<\/p>\n<pre class=\"ph pi pj pk pl pm pn po pp ax pq bj\"><span id=\"9cb2\" class=\"oq no fo pn b ho pr ps l ie pt\" data-selectable-paragraph=\"\">plt.figure(figsize=(13, 8))\nplt.title(\"Product Bought by Individuals through Social Media Marketing\")<\/span><span id=\"6f24\" class=\"oq no fo pn b ho pu ps l ie pt\" data-selectable-paragraph=\"\">sns.histplot(data=df, x=\"Age\", hue=\"Purchased\")\nplt.show()<\/span><\/pre>\n<figure class=\"ph pi pj pk pl mc lu lv paragraph-image\">\n<div class=\"md me eb mf bg mg\" tabindex=\"0\" role=\"button\">\n<figure><img loading=\"lazy\" decoding=\"async\" class=\"bg mh mi c\" role=\"presentation\" src=\"https:\/\/miro.medium.com\/v2\/resize:fit:700\/1*2mpgpqSYK9WehPOH02_ZdQ.png\" alt=\"\" width=\"700\" height=\"461\"><\/figure><div class=\"lu lv qo\"><picture><source srcset=\"https:\/\/miro.medium.com\/v2\/resize:fit:640\/format:webp\/1*2mpgpqSYK9WehPOH02_ZdQ.png 640w, https:\/\/miro.medium.com\/v2\/resize:fit:720\/format:webp\/1*2mpgpqSYK9WehPOH02_ZdQ.png 720w, https:\/\/miro.medium.com\/v2\/resize:fit:750\/format:webp\/1*2mpgpqSYK9WehPOH02_ZdQ.png 750w, https:\/\/miro.medium.com\/v2\/resize:fit:786\/format:webp\/1*2mpgpqSYK9WehPOH02_ZdQ.png 786w, https:\/\/miro.medium.com\/v2\/resize:fit:828\/format:webp\/1*2mpgpqSYK9WehPOH02_ZdQ.png 828w, https:\/\/miro.medium.com\/v2\/resize:fit:1100\/format:webp\/1*2mpgpqSYK9WehPOH02_ZdQ.png 1100w, https:\/\/miro.medium.com\/v2\/resize:fit:1400\/format:webp\/1*2mpgpqSYK9WehPOH02_ZdQ.png 1400w\" type=\"image\/webp\" sizes=\"(min-resolution: 4dppx) and (max-width: 700px) 50vw, (-webkit-min-device-pixel-ratio: 4) and (max-width: 700px) 50vw, (min-resolution: 3dppx) and (max-width: 700px) 67vw, (-webkit-min-device-pixel-ratio: 3) and (max-width: 700px) 65vw, (min-resolution: 2.5dppx) and (max-width: 700px) 80vw, (-webkit-min-device-pixel-ratio: 2.5) and (max-width: 700px) 80vw, (min-resolution: 2dppx) and (max-width: 700px) 100vw, (-webkit-min-device-pixel-ratio: 2) and (max-width: 700px) 100vw, 700px\"><source srcset=\"https:\/\/miro.medium.com\/v2\/resize:fit:640\/1*2mpgpqSYK9WehPOH02_ZdQ.png 640w, https:\/\/miro.medium.com\/v2\/resize:fit:720\/1*2mpgpqSYK9WehPOH02_ZdQ.png 720w, https:\/\/miro.medium.com\/v2\/resize:fit:750\/1*2mpgpqSYK9WehPOH02_ZdQ.png 750w, https:\/\/miro.medium.com\/v2\/resize:fit:786\/1*2mpgpqSYK9WehPOH02_ZdQ.png 786w, https:\/\/miro.medium.com\/v2\/resize:fit:828\/1*2mpgpqSYK9WehPOH02_ZdQ.png 828w, https:\/\/miro.medium.com\/v2\/resize:fit:1100\/1*2mpgpqSYK9WehPOH02_ZdQ.png 1100w, https:\/\/miro.medium.com\/v2\/resize:fit:1400\/1*2mpgpqSYK9WehPOH02_ZdQ.png 1400w\" sizes=\"(min-resolution: 4dppx) and (max-width: 700px) 50vw, (-webkit-min-device-pixel-ratio: 4) and (max-width: 700px) 50vw, (min-resolution: 3dppx) and (max-width: 700px) 67vw, (-webkit-min-device-pixel-ratio: 3) and (max-width: 700px) 65vw, (min-resolution: 2.5dppx) and (max-width: 700px) 80vw, (-webkit-min-device-pixel-ratio: 2.5) and (max-width: 700px) 80vw, (min-resolution: 2dppx) and (max-width: 700px) 100vw, (-webkit-min-device-pixel-ratio: 2) and (max-width: 700px) 100vw, 700px\" data-testid=\"og\"><\/picture><\/div>\n<\/div>\n<figcaption class=\"mj mk ml lu lv mm mn be b bf z dv\" data-selectable-paragraph=\"\">dataset trend \u2014 age range<\/figcaption>\n<\/figure>\n<p id=\"5269\" class=\"pw-post-body-paragraph mp mq fo be b mr ms mt mu mv mw mx my mz na nb nc nd ne nf ng nh ni nj nk nl fh bj\" data-selectable-paragraph=\"\">You will notice from the visualization the age range of people that are likely to buy the product are people over <strong class=\"be nm\">45<\/strong> years of age. Where <strong class=\"be nm\">0<\/strong> simply refers to people not likely to buy and <strong class=\"be nm\">1<\/strong> refers to people most likely to buy.<\/p>\n<p id=\"d232\" class=\"pw-post-body-paragraph mp mq fo be b mr ms mt mu mv mw mx my mz na nb nc nd ne nf ng nh ni nj nk nl fh bj\" data-selectable-paragraph=\"\">Let\u2019s also have a look at the income group of people who responded to the ads and bought the product.<\/p>\n<pre class=\"ph pi pj pk pl pm pn po pp ax pq bj\"><span id=\"c5f7\" class=\"oq no fo pn b ho pr ps l ie pt\" data-selectable-paragraph=\"\">plt.figure(figsize=(13, 8))\nplt.title(\"Product Purchased by Individuals Depending on Income\")\nsns.histplot(data=df, x=\"EstimatedSalary\", hue=\"Purchased\")\nplt.show()<\/span><\/pre>\n<figure class=\"ph pi pj pk pl mc lu lv paragraph-image\">\n<div class=\"md me eb mf bg mg\" tabindex=\"0\" role=\"button\">\n<figure><img loading=\"lazy\" decoding=\"async\" class=\"bg mh mi c\" role=\"presentation\" src=\"https:\/\/miro.medium.com\/v2\/resize:fit:700\/1*SJEgfae1QGehxOBHStlvtg.png\" alt=\"\" width=\"700\" height=\"461\"><\/figure><div class=\"lu lv qo\"><picture><source srcset=\"https:\/\/miro.medium.com\/v2\/resize:fit:640\/format:webp\/1*SJEgfae1QGehxOBHStlvtg.png 640w, https:\/\/miro.medium.com\/v2\/resize:fit:720\/format:webp\/1*SJEgfae1QGehxOBHStlvtg.png 720w, https:\/\/miro.medium.com\/v2\/resize:fit:750\/format:webp\/1*SJEgfae1QGehxOBHStlvtg.png 750w, https:\/\/miro.medium.com\/v2\/resize:fit:786\/format:webp\/1*SJEgfae1QGehxOBHStlvtg.png 786w, https:\/\/miro.medium.com\/v2\/resize:fit:828\/format:webp\/1*SJEgfae1QGehxOBHStlvtg.png 828w, https:\/\/miro.medium.com\/v2\/resize:fit:1100\/format:webp\/1*SJEgfae1QGehxOBHStlvtg.png 1100w, https:\/\/miro.medium.com\/v2\/resize:fit:1400\/format:webp\/1*SJEgfae1QGehxOBHStlvtg.png 1400w\" type=\"image\/webp\" sizes=\"(min-resolution: 4dppx) and (max-width: 700px) 50vw, (-webkit-min-device-pixel-ratio: 4) and (max-width: 700px) 50vw, (min-resolution: 3dppx) and (max-width: 700px) 67vw, (-webkit-min-device-pixel-ratio: 3) and (max-width: 700px) 65vw, (min-resolution: 2.5dppx) and (max-width: 700px) 80vw, (-webkit-min-device-pixel-ratio: 2.5) and (max-width: 700px) 80vw, (min-resolution: 2dppx) and (max-width: 700px) 100vw, (-webkit-min-device-pixel-ratio: 2) and (max-width: 700px) 100vw, 700px\"><source srcset=\"https:\/\/miro.medium.com\/v2\/resize:fit:640\/1*SJEgfae1QGehxOBHStlvtg.png 640w, https:\/\/miro.medium.com\/v2\/resize:fit:720\/1*SJEgfae1QGehxOBHStlvtg.png 720w, https:\/\/miro.medium.com\/v2\/resize:fit:750\/1*SJEgfae1QGehxOBHStlvtg.png 750w, https:\/\/miro.medium.com\/v2\/resize:fit:786\/1*SJEgfae1QGehxOBHStlvtg.png 786w, https:\/\/miro.medium.com\/v2\/resize:fit:828\/1*SJEgfae1QGehxOBHStlvtg.png 828w, https:\/\/miro.medium.com\/v2\/resize:fit:1100\/1*SJEgfae1QGehxOBHStlvtg.png 1100w, https:\/\/miro.medium.com\/v2\/resize:fit:1400\/1*SJEgfae1QGehxOBHStlvtg.png 1400w\" sizes=\"(min-resolution: 4dppx) and (max-width: 700px) 50vw, (-webkit-min-device-pixel-ratio: 4) and (max-width: 700px) 50vw, (min-resolution: 3dppx) and (max-width: 700px) 67vw, (-webkit-min-device-pixel-ratio: 3) and (max-width: 700px) 65vw, (min-resolution: 2.5dppx) and (max-width: 700px) 80vw, (-webkit-min-device-pixel-ratio: 2.5) and (max-width: 700px) 80vw, (min-resolution: 2dppx) and (max-width: 700px) 100vw, (-webkit-min-device-pixel-ratio: 2) and (max-width: 700px) 100vw, 700px\" data-testid=\"og\"><\/picture><\/div>\n<\/div>\n<figcaption class=\"mj mk ml lu lv mm mn be b bf z dv\" data-selectable-paragraph=\"\">dataset trend \u2014 income group<\/figcaption>\n<\/figure>\n<p id=\"12ff\" class=\"pw-post-body-paragraph mp mq fo be b mr ms mt mu mv mw mx my mz na nb nc nd ne nf ng nh ni nj nk nl fh bj\" data-selectable-paragraph=\"\">According to the visualization above, the target audience\u2019s members who make above $90,000 per month are more likely to buy the product.<\/p>\n<h2 id=\"8233\" class=\"oq no fo be np or os ot nt ou ov ow nx mz ox oy oz nd pa pb pc nh pd pe pf pg bj\" data-selectable-paragraph=\"\">The classification model<\/h2>\n<p id=\"15f6\" class=\"pw-post-body-paragraph mp mq fo be b mr ol mt mu mv om mx my mz on nb nc nd oo nf ng nh op nj nk nl fh bj\" data-selectable-paragraph=\"\">Now let\u2019s train a model to classify social media ads. First I\u2019ll set the <code class=\"cw qp qq qr pn b\">Purchased <\/code>column in the dataset as the <strong class=\"be nm\">target<\/strong> variable and the other two columns <code class=\"cw qp qq qr pn b\">Age<\/code> &amp; <code class=\"cw qp qq qr pn b\">EstimatedSalary<\/code> as the <strong class=\"be nm\">features<\/strong> we need to train the model.<\/p>\n<pre class=\"ph pi pj pk pl pm pn po pp ax pq bj\"><span id=\"a75f\" class=\"oq no fo pn b ho pr ps l ie pt\" data-selectable-paragraph=\"\">x = np.array(df[[\"Age\", \"EstimatedSalary\"]])\ny = np.array(df[[\"Purchased\"]])<\/span><\/pre>\n<h2 id=\"6a33\" class=\"oq no fo be np or os ot nt ou ov ow nx mz ox oy oz nd pa pb pc nh pd pe pf pg bj\" data-selectable-paragraph=\"\">Train test split<\/h2>\n<p id=\"5a2a\" class=\"pw-post-body-paragraph mp mq fo be b mr ol mt mu mv om mx my mz on nb nc nd oo nf ng nh op nj nk nl fh bj\" data-selectable-paragraph=\"\">We will divide the data now, and a social media ads classification model with the help of the <strong class=\"be nm\">Decision Tree Classifier<\/strong>.<\/p>\n<pre class=\"ph pi pj pk pl pm pn po pp ax pq bj\"><span id=\"daa9\" class=\"oq no fo pn b ho pr ps l ie pt\" data-selectable-paragraph=\"\">xtrain, xtest, ytrain, ytest = train_test_split(x, y, test_size=0.10, random_state=42)<\/span><span id=\"a6d7\" class=\"oq no fo pn b ho pu ps l ie pt\" data-selectable-paragraph=\"\">model = DecisionTreeClassifier()\nmodel.fit(xtrain, ytrain)\npredictions = model.predict(xtest)<\/span><\/pre>\n<p id=\"5f20\" class=\"pw-post-body-paragraph mp mq fo be b mr ms mt mu mv mw mx my mz na nb nc nd ne nf ng nh ni nj nk nl fh bj\" data-selectable-paragraph=\"\">The <code class=\"cw qp qq qr pn b\">test_size<\/code> is 10%.<\/p>\n<p id=\"f8d4\" class=\"pw-post-body-paragraph mp mq fo be b mr ms mt mu mv mw mx my mz na nb nc nd ne nf ng nh ni nj nk nl fh bj\" data-selectable-paragraph=\"\">Let\u2019s last have a look at the model\u2019s classification report.<\/p>\n<pre class=\"ph pi pj pk pl pm pn po pp ax pq bj\"><span id=\"9f91\" class=\"oq no fo pn b ho pr ps l ie pt\" data-selectable-paragraph=\"\">print(classification_report(ytest, predictions))<\/span><\/pre>\n<figure class=\"ph pi pj pk pl mc lu lv paragraph-image\">\n<div class=\"md me eb mf bg mg\" tabindex=\"0\" role=\"button\">\n<figure><img loading=\"lazy\" decoding=\"async\" class=\"bg mh mi c\" role=\"presentation\" src=\"https:\/\/miro.medium.com\/v2\/resize:fit:700\/1*KF3rpmpU1mwkG8C7QDkxRw.png\" alt=\"\" width=\"700\" height=\"224\"><\/figure><div class=\"lu lv qs\"><picture><source srcset=\"https:\/\/miro.medium.com\/v2\/resize:fit:640\/format:webp\/1*KF3rpmpU1mwkG8C7QDkxRw.png 640w, https:\/\/miro.medium.com\/v2\/resize:fit:720\/format:webp\/1*KF3rpmpU1mwkG8C7QDkxRw.png 720w, https:\/\/miro.medium.com\/v2\/resize:fit:750\/format:webp\/1*KF3rpmpU1mwkG8C7QDkxRw.png 750w, https:\/\/miro.medium.com\/v2\/resize:fit:786\/format:webp\/1*KF3rpmpU1mwkG8C7QDkxRw.png 786w, https:\/\/miro.medium.com\/v2\/resize:fit:828\/format:webp\/1*KF3rpmpU1mwkG8C7QDkxRw.png 828w, https:\/\/miro.medium.com\/v2\/resize:fit:1100\/format:webp\/1*KF3rpmpU1mwkG8C7QDkxRw.png 1100w, https:\/\/miro.medium.com\/v2\/resize:fit:1400\/format:webp\/1*KF3rpmpU1mwkG8C7QDkxRw.png 1400w\" type=\"image\/webp\" sizes=\"(min-resolution: 4dppx) and (max-width: 700px) 50vw, (-webkit-min-device-pixel-ratio: 4) and (max-width: 700px) 50vw, (min-resolution: 3dppx) and (max-width: 700px) 67vw, (-webkit-min-device-pixel-ratio: 3) and (max-width: 700px) 65vw, (min-resolution: 2.5dppx) and (max-width: 700px) 80vw, (-webkit-min-device-pixel-ratio: 2.5) and (max-width: 700px) 80vw, (min-resolution: 2dppx) and (max-width: 700px) 100vw, (-webkit-min-device-pixel-ratio: 2) and (max-width: 700px) 100vw, 700px\"><source srcset=\"https:\/\/miro.medium.com\/v2\/resize:fit:640\/1*KF3rpmpU1mwkG8C7QDkxRw.png 640w, https:\/\/miro.medium.com\/v2\/resize:fit:720\/1*KF3rpmpU1mwkG8C7QDkxRw.png 720w, https:\/\/miro.medium.com\/v2\/resize:fit:750\/1*KF3rpmpU1mwkG8C7QDkxRw.png 750w, https:\/\/miro.medium.com\/v2\/resize:fit:786\/1*KF3rpmpU1mwkG8C7QDkxRw.png 786w, https:\/\/miro.medium.com\/v2\/resize:fit:828\/1*KF3rpmpU1mwkG8C7QDkxRw.png 828w, https:\/\/miro.medium.com\/v2\/resize:fit:1100\/1*KF3rpmpU1mwkG8C7QDkxRw.png 1100w, https:\/\/miro.medium.com\/v2\/resize:fit:1400\/1*KF3rpmpU1mwkG8C7QDkxRw.png 1400w\" sizes=\"(min-resolution: 4dppx) and (max-width: 700px) 50vw, (-webkit-min-device-pixel-ratio: 4) and (max-width: 700px) 50vw, (min-resolution: 3dppx) and (max-width: 700px) 67vw, (-webkit-min-device-pixel-ratio: 3) and (max-width: 700px) 65vw, (min-resolution: 2.5dppx) and (max-width: 700px) 80vw, (-webkit-min-device-pixel-ratio: 2.5) and (max-width: 700px) 80vw, (min-resolution: 2dppx) and (max-width: 700px) 100vw, (-webkit-min-device-pixel-ratio: 2) and (max-width: 700px) 100vw, 700px\" data-testid=\"og\"><\/picture><\/div>\n<\/div>\n<figcaption class=\"mj mk ml lu lv mm mn be b bf z dv\" data-selectable-paragraph=\"\">classification report<\/figcaption>\n<\/figure>\n<h1 id=\"36cc\" class=\"nn no fo be np nq nr ns nt nu nv nw nx ny nz oa ob oc od oe of og oh oi oj ok bj\" data-selectable-paragraph=\"\">Conclusion<\/h1>\n<p id=\"9301\" class=\"pw-post-body-paragraph mp mq fo be b mr ol mt mu mv om mx my mz on nb nc nd oo nf ng nh op nj nk nl fh bj\" data-selectable-paragraph=\"\">So, this is how you may evaluate and categorize social media ads related to a product\u2019s marketing campaign. We discussed in-depth social media ads, the benefits of using machine learning, and finally, we worked on a social media ads classification model using <strong class=\"be nm\">Decision Tree Classifier<\/strong>. In order to categorize social media advertisements, you must first analyze your social media campaigns to identify the most lucrative and likely to purchase clients. I strongly advise you to explore additional online resources about different applications of machine learning in social media advertising.<\/p>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>image source: Pixabay Social media first served as a space for individuals, but companies have since seen the potential. Top social media sites are becoming effective marketing tools, perhaps taking the place of more conventional options like TV ads or brochures. The internet is a key marketing tool that may be utilized to increase brand [&hellip;]<\/p>\n","protected":false},"author":8,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"customer_name":"","customer_description":"","customer_industry":"","customer_technologies":"","customer_logo":"","footnotes":""},"categories":[6,7],"tags":[],"coauthors":[143],"class_list":["post-7796","post","type-post","status-publish","format-standard","hentry","category-machine-learning","category-tutorials"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v25.9 (Yoast SEO v25.9) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Machine Learning for Classifying Social Media Ads - Comet<\/title>\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.comet.com\/site\/blog\/machine-learning-for-classifying-social-media-ads\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Machine Learning for Classifying Social Media Ads\" \/>\n<meta property=\"og:description\" content=\"image source: Pixabay Social media first served as a space for individuals, but companies have since seen the potential. Top social media sites are becoming effective marketing tools, perhaps taking the place of more conventional options like TV ads or brochures. The internet is a key marketing tool that may be utilized to increase brand [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.comet.com\/site\/blog\/machine-learning-for-classifying-social-media-ads\/\" \/>\n<meta property=\"og:site_name\" content=\"Comet\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/cometdotml\" \/>\n<meta property=\"article:published_time\" content=\"2023-10-04T19:18:06+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-04-24T17:06:02+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/miro.medium.com\/v2\/resize:fit:700\/1*RNNS9wYIOj4Cb4gkBbiTow.jpeg\" \/>\n<meta name=\"author\" content=\"Shittu Olumide Ayodeji\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@Cometml\" \/>\n<meta name=\"twitter:site\" content=\"@Cometml\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Shittu Olumide Ayodeji\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Machine Learning for Classifying Social Media Ads - Comet","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.comet.com\/site\/blog\/machine-learning-for-classifying-social-media-ads\/","og_locale":"en_US","og_type":"article","og_title":"Machine Learning for Classifying Social Media Ads","og_description":"image source: Pixabay Social media first served as a space for individuals, but companies have since seen the potential. Top social media sites are becoming effective marketing tools, perhaps taking the place of more conventional options like TV ads or brochures. The internet is a key marketing tool that may be utilized to increase brand [&hellip;]","og_url":"https:\/\/www.comet.com\/site\/blog\/machine-learning-for-classifying-social-media-ads\/","og_site_name":"Comet","article_publisher":"https:\/\/www.facebook.com\/cometdotml","article_published_time":"2023-10-04T19:18:06+00:00","article_modified_time":"2025-04-24T17:06:02+00:00","og_image":[{"url":"https:\/\/miro.medium.com\/v2\/resize:fit:700\/1*RNNS9wYIOj4Cb4gkBbiTow.jpeg","type":"","width":"","height":""}],"author":"Shittu Olumide Ayodeji","twitter_card":"summary_large_image","twitter_creator":"@Cometml","twitter_site":"@Cometml","twitter_misc":{"Written by":"Shittu Olumide Ayodeji","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.comet.com\/site\/blog\/machine-learning-for-classifying-social-media-ads\/#article","isPartOf":{"@id":"https:\/\/www.comet.com\/site\/blog\/machine-learning-for-classifying-social-media-ads\/"},"author":{"name":"Team Comet Digital","@id":"https:\/\/www.comet.com\/site\/#\/schema\/person\/6266601170c60a7a82b3e0043fbe8ddf"},"headline":"Machine Learning for Classifying Social Media Ads","datePublished":"2023-10-04T19:18:06+00:00","dateModified":"2025-04-24T17:06:02+00:00","mainEntityOfPage":{"@id":"https:\/\/www.comet.com\/site\/blog\/machine-learning-for-classifying-social-media-ads\/"},"wordCount":1121,"publisher":{"@id":"https:\/\/www.comet.com\/site\/#organization"},"image":{"@id":"https:\/\/www.comet.com\/site\/blog\/machine-learning-for-classifying-social-media-ads\/#primaryimage"},"thumbnailUrl":"https:\/\/miro.medium.com\/v2\/resize:fit:700\/1*RNNS9wYIOj4Cb4gkBbiTow.jpeg","articleSection":["Machine Learning","Tutorials"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.comet.com\/site\/blog\/machine-learning-for-classifying-social-media-ads\/","url":"https:\/\/www.comet.com\/site\/blog\/machine-learning-for-classifying-social-media-ads\/","name":"Machine Learning for Classifying Social Media Ads - Comet","isPartOf":{"@id":"https:\/\/www.comet.com\/site\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.comet.com\/site\/blog\/machine-learning-for-classifying-social-media-ads\/#primaryimage"},"image":{"@id":"https:\/\/www.comet.com\/site\/blog\/machine-learning-for-classifying-social-media-ads\/#primaryimage"},"thumbnailUrl":"https:\/\/miro.medium.com\/v2\/resize:fit:700\/1*RNNS9wYIOj4Cb4gkBbiTow.jpeg","datePublished":"2023-10-04T19:18:06+00:00","dateModified":"2025-04-24T17:06:02+00:00","breadcrumb":{"@id":"https:\/\/www.comet.com\/site\/blog\/machine-learning-for-classifying-social-media-ads\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.comet.com\/site\/blog\/machine-learning-for-classifying-social-media-ads\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.comet.com\/site\/blog\/machine-learning-for-classifying-social-media-ads\/#primaryimage","url":"https:\/\/miro.medium.com\/v2\/resize:fit:700\/1*RNNS9wYIOj4Cb4gkBbiTow.jpeg","contentUrl":"https:\/\/miro.medium.com\/v2\/resize:fit:700\/1*RNNS9wYIOj4Cb4gkBbiTow.jpeg"},{"@type":"BreadcrumbList","@id":"https:\/\/www.comet.com\/site\/blog\/machine-learning-for-classifying-social-media-ads\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.comet.com\/site\/"},{"@type":"ListItem","position":2,"name":"Machine Learning for Classifying Social Media Ads"}]},{"@type":"WebSite","@id":"https:\/\/www.comet.com\/site\/#website","url":"https:\/\/www.comet.com\/site\/","name":"Comet","description":"Build Better Models Faster","publisher":{"@id":"https:\/\/www.comet.com\/site\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.comet.com\/site\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.comet.com\/site\/#organization","name":"Comet ML, Inc.","alternateName":"Comet","url":"https:\/\/www.comet.com\/site\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.comet.com\/site\/#\/schema\/logo\/image\/","url":"https:\/\/www.comet.com\/site\/wp-content\/uploads\/2025\/01\/logo_comet_square.png","contentUrl":"https:\/\/www.comet.com\/site\/wp-content\/uploads\/2025\/01\/logo_comet_square.png","width":310,"height":310,"caption":"Comet ML, Inc."},"image":{"@id":"https:\/\/www.comet.com\/site\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/cometdotml","https:\/\/x.com\/Cometml","https:\/\/www.youtube.com\/channel\/UCmN63HKvfXSCS-UwVwmK8Hw"]},{"@type":"Person","@id":"https:\/\/www.comet.com\/site\/#\/schema\/person\/6266601170c60a7a82b3e0043fbe8ddf","name":"Team Comet Digital","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.comet.com\/site\/#\/schema\/person\/image\/4f0c0a8cc7c0e87c636ff6a420a6647c","url":"https:\/\/www.comet.com\/site\/wp-content\/uploads\/2023\/08\/Screen-Shot-2023-08-12-at-8.58.50-AM-96x96.png","contentUrl":"https:\/\/www.comet.com\/site\/wp-content\/uploads\/2023\/08\/Screen-Shot-2023-08-12-at-8.58.50-AM-96x96.png","caption":"Team Comet Digital"},"sameAs":["https:\/\/www.comet.ml\/"],"url":"https:\/\/www.comet.com\/site\/blog\/author\/teamcometdigital\/"}]}},"_links":{"self":[{"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/posts\/7796","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/comments?post=7796"}],"version-history":[{"count":1,"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/posts\/7796\/revisions"}],"predecessor-version":[{"id":15520,"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/posts\/7796\/revisions\/15520"}],"wp:attachment":[{"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/media?parent=7796"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/categories?post=7796"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/tags?post=7796"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/coauthors?post=7796"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}