{"id":116,"date":"2024-06-02T22:57:00","date_gmt":"2024-06-02T22:57:00","guid":{"rendered":"https:\/\/amirhooshang.com\/blog\/?p=116"},"modified":"2025-05-17T23:05:26","modified_gmt":"2025-05-17T23:05:26","slug":"active-learning-metrics-in-machine-learning-how-to-handle-data-like-a-pro","status":"publish","type":"post","link":"https:\/\/amirhooshang.com\/blog\/2024\/06\/02\/active-learning-metrics-in-machine-learning-how-to-handle-data-like-a-pro\/","title":{"rendered":"Active Learning Metrics in Machine Learning: How to Handle Data Like a Pro!"},"content":{"rendered":"\n<h3 class=\"wp-block-heading\"><strong>Introduction: The Never-Ending Struggle!<\/strong><\/h3>\n\n\n\n<p>Imagine training a machine learning model, but labeling data takes so much time and money that you want to quit! \ud83d\ude05 That\u2019s where <strong>Active Learning<\/strong> swoops in like a superhero. Instead of using all the data, the model <em>selectively picks<\/em> the most impactful samples and says, \u201cLabel this one, skip the rest!\u201d But the big question is: <strong>How do we identify these \u201cimportant\u201d samples?<\/strong> The answer lies in choosing the right <strong>query strategies<\/strong> (metrics). In this article, I\u2019ll break down these strategies in plain English, explain how they work, and when to use them.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>The Metrics: What Do They Do to Your Model?<\/strong><\/h3>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>1. Uncertainty Sampling: When the Model Gets Confused!<\/strong><\/h4>\n\n\n\n<p><strong>Simple Definition:<\/strong> Think of your model as a student unsure about certain exam questions. This strategy says, \u201cAsk the student to label the questions they\u2019re most confused about!\u201d<br><strong>Real-World Example:<\/strong> If you\u2019re classifying cat vs. dog images and the model says, \u201cHmm\u2026 49% cat, 51% dog?\u201d\u2014that image gets labeled first!<br><strong>How It\u2019s Measured:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Least Confidence:<\/strong> The model has the lowest confidence in its prediction.<\/li>\n\n\n\n<li><strong>Margin Sampling:<\/strong> The difference between the top two predicted probabilities is tiny.<\/li>\n\n\n\n<li><strong>Entropy:<\/strong> The more chaotic the probability distribution, the more confused the model is!<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>2. Query-By-Committee: Let the Models Vote!<\/strong><\/h4>\n\n\n\n<p><strong>Simple Definition:<\/strong> Imagine three friends arguing over a problem. If they <em>disagree the most<\/em> on a question, that\u2019s the one worth solving! Here, multiple models (a \u201ccommittee\u201d) are trained, and samples with the <em>highest disagreement<\/em> are selected.<br><strong>Everyday Example:<\/strong> In spam detection, if half the models call an email \u201cspam\u201d and the other half say \u201cnot spam,\u201d that email needs a label to settle the debate!<br><strong>Tools Used:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Vote Entropy:<\/strong> Measures how scattered the committee\u2019s predictions are.<\/li>\n\n\n\n<li><strong>KL Divergence:<\/strong> Quantifies differences in probability distributions between models.<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>3. Expected Model Change: Shock Your Model into Learning!<\/strong><\/h4>\n\n\n\n<p><strong>Simple Definition:<\/strong> Some data points are so impactful that showing them to the model forces it to <em>rethink everything<\/em>. This metric hunts for those \u201cmind-blowing\u201d samples.<br><strong>Example:<\/strong> Training a linear regression model? If adding a data point flips the trendline\u2019s direction, label that point ASAP!<br><strong>The Catch:<\/strong> Calculating each sample\u2019s impact is computationally heavy, especially for complex models like neural networks.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>4. Density-Based Methods: Important Data in Crowded Areas!<\/strong><\/h4>\n\n\n\n<p><strong>Simple Definition:<\/strong> Some samples are both <em>confusing<\/em> and <em>representative<\/em> of dense data regions. Think of a confusing comment in a busy Reddit thread\u2014labeling it helps the model understand the crowd!<br><strong>Real-Life Example:<\/strong> Analyzing smartphone reviews? If a user writes, \u201cThis phone is great\u2026 but I don\u2019t know why!\u201d, that review is ambiguous <em>and<\/em> likely part of a common trend.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Combining Metrics: Like Peanut Butter and Jelly! \ud83e\udd5c<\/strong><\/h3>\n\n\n\n<p>Using one metric alone is like eating plain bread\u2014it works, but why not add some flavor? Mix strategies to fix their weaknesses!<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Popular Combo: Uncertainty + Density<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Problem with Uncertainty:<\/strong> It might focus on weird outliers (like a \u201cwinged cat\u201d image).<\/li>\n\n\n\n<li><strong>Solution:<\/strong> Add density to prioritize confusing samples <em>from crowded regions<\/em>. It\u2019s like filtering noise while keeping the signal!<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Committee + Model Change<\/strong><\/h4>\n\n\n\n<p>If your goal is rapid model updates, combine committee disagreement with samples that <em>shake up<\/em> the model\u2019s parameters. For example, in stock price prediction, use both expert opinions and data that triggers big adjustments.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Conclusion: Every Model Has Its Story!<\/strong><\/h3>\n\n\n\n<p>Choosing metrics depends on three things:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Your Data\u2019s Personality:<\/strong> Got outliers? Use density! Clean data? Stick with uncertainty.<\/li>\n\n\n\n<li><strong>Resources:<\/strong> Limited compute? Keep it simple with uncertainty sampling.<\/li>\n\n\n\n<li><strong>End Goal:<\/strong> Speed vs. accuracy? Medical diagnosis needs combo metrics; news categorization can go solo.<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\"><\/h3>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction: The Never-Ending Struggle! Imagine training a machine learning model, but labeling data takes so much time and money that you want to quit! \ud83d\ude05 That\u2019s where Active Learning swoops&#8230;<\/p>\n","protected":false},"author":1,"featured_media":117,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[61,62],"tags":[125,131,130,127,126,128,129],"class_list":["post-116","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-machine-learning","category-model-evaluation","tag-active-learning","tag-density-based-sampling","tag-labeling-cost-reduction","tag-model-training-efficiency","tag-query-strategies","tag-query-by-committee","tag-uncertainty-sampling"],"_links":{"self":[{"href":"https:\/\/amirhooshang.com\/blog\/wp-json\/wp\/v2\/posts\/116","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/amirhooshang.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/amirhooshang.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/amirhooshang.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/amirhooshang.com\/blog\/wp-json\/wp\/v2\/comments?post=116"}],"version-history":[{"count":1,"href":"https:\/\/amirhooshang.com\/blog\/wp-json\/wp\/v2\/posts\/116\/revisions"}],"predecessor-version":[{"id":118,"href":"https:\/\/amirhooshang.com\/blog\/wp-json\/wp\/v2\/posts\/116\/revisions\/118"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/amirhooshang.com\/blog\/wp-json\/wp\/v2\/media\/117"}],"wp:attachment":[{"href":"https:\/\/amirhooshang.com\/blog\/wp-json\/wp\/v2\/media?parent=116"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/amirhooshang.com\/blog\/wp-json\/wp\/v2\/categories?post=116"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/amirhooshang.com\/blog\/wp-json\/wp\/v2\/tags?post=116"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}