{"id":132,"date":"2024-10-02T17:48:00","date_gmt":"2024-10-02T17:48:00","guid":{"rendered":"https:\/\/amirhooshang.com\/blog\/?p=132"},"modified":"2025-05-19T17:59:04","modified_gmt":"2025-05-19T17:59:04","slug":"machine-learning-metrics-in-evolutionary-learning-like-baking-the-perfect-pizza","status":"publish","type":"post","link":"https:\/\/amirhooshang.com\/blog\/2024\/10\/02\/machine-learning-metrics-in-evolutionary-learning-like-baking-the-perfect-pizza\/","title":{"rendered":"Machine Learning Metrics in Evolutionary Learning: Like Baking the Perfect Pizza!"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\"><strong>Intro: Evolution Isn\u2019t Just for Dinosaurs!<\/strong><\/h2>\n\n\n\n<p>Evolutionary Learning is like cooking without a recipe! You toss your ingredients (data) into the pot, tweak things through trial and error (evolution), and keep tasting until you nail the perfect flavor. In this process, <strong>evaluation metrics<\/strong> act like your &#8220;taste-testers,&#8221; deciding which recipe (machine learning model) deserves a spot in the next round!<br>This article breaks down how these &#8220;taste-testers&#8221; (metrics) work, why you sometimes need to mix them like spices, and why others get tossed out. With real-world examples\u2014from disease diagnosis to soccer-playing robots!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>What Are Metrics? Let\u2019s Break \u2019Em Down!<\/strong><\/h2>\n\n\n\n<p>Metrics are tools that tell you how well your model performs. Imagine building a cat-vs-dog image classifier. Metrics are like a report card: &#8220;Great job, 80% correct!&#8221; or &#8220;Oops, you messed up this time!&#8221;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>1. Accuracy: The Model\u2019s Report Card<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Casual Definition<\/strong>: Out of 10 predictions, how many were right? If your model correctly labels 90 out of 100 cat images, its accuracy is 90%.<\/li>\n\n\n\n<li><strong>Fun Example<\/strong>: Think of a free-throw contest\u2014if you score 8 out of 10 shots, your accuracy is 80%!<\/li>\n\n\n\n<li><strong>The Catch<\/strong>: If classes are imbalanced (e.g., 95% &#8220;dog&#8221; vs. 5% &#8220;cat&#8221;), your model can cheat by always guessing &#8220;dog&#8221; for 95% accuracy. Sneaky, right? \ud83d\ude05<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>2. Precision: The Nitpicky Perfectionist<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Casual Definition<\/strong>: Of all the positives you predicted, how many were <em>actually<\/em> positive?<\/li>\n\n\n\n<li><strong>Real-Life Example<\/strong>: Your spam filter labels 100 emails as &#8220;spam,&#8221; but only 80 are truly spam. Precision = 80%.<\/li>\n\n\n\n<li><strong>When to Use It<\/strong>: When <strong>false positives<\/strong> are costly. Like marking an important email as spam\u2014oops, you just lost a job offer!<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>3. Recall: The Optimist Who Wants to Catch Everything<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Casual Definition<\/strong>: Of all <em>actual<\/em> positives, how many did you catch?<\/li>\n\n\n\n<li><strong>Medical Example<\/strong>: If 100 people have COVID and your test flags 90, recall = 90%.<\/li>\n\n\n\n<li><strong>Why It Matters<\/strong>: When <strong>false negatives<\/strong> are dangerous. Missing a cancer diagnosis? That\u2019s a nightmare!<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>4. F1 Score: The Peacemaker Between Precision &amp; Recall<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Casual Definition<\/strong>: A balanced average of precision and recall. If precision is 70% and recall is 80%, F1 \u2248 75%.<\/li>\n\n\n\n<li><strong>Example<\/strong>: You want to catch most spam (high recall) without trashing important emails (high precision). F1 keeps both in check!<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Evolutionary Learning: A Soccer Game with Weird Rules!<\/strong><\/h2>\n\n\n\n<p>Evolutionary Learning uses genetic algorithms (GAs) to improve models over generations. Here, metrics act like <strong>referees<\/strong>:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>High accuracy? Give it a point.<\/li>\n\n\n\n<li>High recall? Another point.<br>Evolutionary algorithms pick models that score well on <em>multiple<\/em> metrics\u2014like training a soccer team to defend <em>and<\/em> attack!<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Mixing Metrics: Teaming Up with Friends<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Example 1: Fraud Detection<\/strong><\/li>\n\n\n\n<li><strong>Goal<\/strong>: Catch fraud (high recall) without accusing innocent folks (high precision).<\/li>\n\n\n\n<li><strong>Trick<\/strong>: Use multi-objective algorithms like NSGA-II\u2014think of a coach yelling, &#8220;Defend hard, but don\u2019t forget to score!&#8221;<\/li>\n\n\n\n<li><strong>Example 2: Self-Driving Cars<\/strong><\/li>\n\n\n\n<li><strong>Goal<\/strong>: Spot obstacles accurately (precision) <em>and<\/em> process data fast (speed).<\/li>\n\n\n\n<li><strong>Trick<\/strong>: Prioritize speed\u2014because a slow reaction could mean a crash!<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Why Some Metrics Get Benche<\/strong>d<\/h2>\n\n\n\n<p><strong>Scenario 1: Imbalanced Data<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>If 99% of your data is &#8220;healthy&#8221; and 1% &#8220;sick,&#8221; accuracy is useless. A model guessing &#8220;healthy&#8221; every time scores 99% accuracy\u2014but fails miserably. Use F1 or recall instead!<\/li>\n\n\n\n<li><strong>Scenario 2: Costly Mistakes<\/strong><\/li>\n\n\n\n<li>In cancer detection, a <strong>false negative<\/strong> (missing a tumor) is deadly. Prioritize recall, even if precision takes a hit.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Conclusion: Metrics Are Like Spices\u2014Use Wisely!<\/strong><\/h2>\n\n\n\n<p>Choosing metrics in Evolutionary Learning is like cooking:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Making soup? Salt matters (accuracy).<\/li>\n\n\n\n<li>Baking cake? Sugar rules (recall).<\/li>\n\n\n\n<li>Sometimes, mix spices (combine metrics)!<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><\/h3>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Intro: Evolution Isn\u2019t Just for Dinosaurs! Evolutionary Learning is like cooking without a recipe! You toss your ingredients (data) into the pot, tweak things through trial and error (evolution), and&#8230;<\/p>\n","protected":false},"author":1,"featured_media":133,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[61,62],"tags":[73,80,156,113,36,159,157,158,74,75],"class_list":["post-132","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-machine-learning","category-model-evaluation","tag-accuracy-2","tag-evaluation-metrics","tag-evolutionary-learning","tag-f1-score-2","tag-genetic-algorithm","tag-imbalanced-data-2","tag-multi-objective-optimization","tag-nsga-ii","tag-precision-2","tag-recall"],"_links":{"self":[{"href":"https:\/\/amirhooshang.com\/blog\/wp-json\/wp\/v2\/posts\/132","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=132"}],"version-history":[{"count":1,"href":"https:\/\/amirhooshang.com\/blog\/wp-json\/wp\/v2\/posts\/132\/revisions"}],"predecessor-version":[{"id":134,"href":"https:\/\/amirhooshang.com\/blog\/wp-json\/wp\/v2\/posts\/132\/revisions\/134"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/amirhooshang.com\/blog\/wp-json\/wp\/v2\/media\/133"}],"wp:attachment":[{"href":"https:\/\/amirhooshang.com\/blog\/wp-json\/wp\/v2\/media?parent=132"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/amirhooshang.com\/blog\/wp-json\/wp\/v2\/categories?post=132"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/amirhooshang.com\/blog\/wp-json\/wp\/v2\/tags?post=132"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}