<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Shrunali Suresh Salian on Medium]]></title>
        <description><![CDATA[Stories by Shrunali Suresh Salian on Medium]]></description>
        <link>https://medium.com/@shrunalisalian97?source=rss-97aa7b72566b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*aUU3bObpegxp-7RPDHnhZw.gif</url>
            <title>Stories by Shrunali Suresh Salian on Medium</title>
            <link>https://medium.com/@shrunalisalian97?source=rss-97aa7b72566b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 19:29:01 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@shrunalisalian97/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Given a budget of US$500 per task, how would you configure o3 or o4-mini to maximize accuracy on a…]]></title>
            <link>https://medium.com/@shrunalisalian97/given-a-budget-of-us-500-per-task-how-would-you-configure-o3-or-o4-mini-to-maximize-accuracy-on-a-ccfd919c2c2a?source=rss-97aa7b72566b------2</link>
            <guid isPermaLink="false">https://medium.com/p/ccfd919c2c2a</guid>
            <dc:creator><![CDATA[Shrunali Suresh Salian]]></dc:creator>
            <pubDate>Sun, 14 Jun 2026 16:50:04 GMT</pubDate>
            <atom:updated>2026-06-14T16:50:04.910Z</atom:updated>
            <content:encoded><![CDATA[<h3>Given a budget of US$500 per task, how would you configure o3 or o4-mini to maximize accuracy on a reasoning benchmark?</h3><p><strong>The interview question that started this:</strong> <em>“Given a budget of $500 per task, how would you configure o3 or o4-mini to maximize accuracy on a reasoning benchmark? Discuss the trade-offs between high-compute variants and cheaper models.”</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/686/1*5JWgRckgcQrnNHZUPKY8EA.jpeg" /><figcaption>source: <a href="https://www.youtube.com/watch?v=JtQOanSpxf4">https://www.youtube.com/watch?v=JtQOanSpxf4</a></figcaption></figure><p>The first time I read this, my brain snagged on the dollar sign. We don’t usually think about AI answers as costing money <em>per question</em>. But that framing is the entire point — and once it clicks, this becomes one of the most intuitive questions in all of machine learning.</p><p>Because stripped of jargon, it’s just this: <strong>you have $500. You want one hard question answered correctly. How do you spend the money?</strong></p><p>Let’s build the answer from scratch.</p><h3>The big realization: there are two totally different ways to spend money on accuracy</h3><p>Here’s the insight everything else hangs on. When you want an AI to get something right, you can spend your budget in two completely different directions.</p><p><strong>Direction 1: buy a bigger, smarter brain.</strong> Use the powerful, expensive model (think o3, cranked up to think really hard). Each attempt costs more — but each attempt is <em>better</em>. You’re paying for <strong>quality per try.</strong></p><p><strong>Direction 2: buy more tries from a cheaper brain.</strong> Use the small, cheap model (think o4-mini), which costs a fraction as much per attempt. Then use your budget to run it <em>many</em> times and combine the results. You’re paying for <strong>quantity of tries.</strong></p><p>Almost everything interesting about this question lives in the tension between these two.</p><p>Here’s the analogy I keep coming back to. You’ve got $500 to get a brutally hard question answered correctly. Do you:</p><ul><li><strong>(a)</strong> hire <em>one</em> world-class expert for an hour, or</li><li><strong>(b)</strong> hire <em>twenty</em> smart-but-cheaper grad students, have each take a crack at it, and go with their consensus?</li></ul><p>Sometimes the lone genius wins. Sometimes twenty decent minds beat the genius. Which strategy wins depends entirely on the question — and <em>that</em> is the trade-off the interviewer wants you to wrestle with.</p><h3>The two knobs you’re actually turning</h3><p>“Configure the model” sounds vague, so let’s make it concrete. You’re really adjusting two dials.</p><p><strong>Knob A — how hard one attempt thinks.</strong> Reasoning models let you dial up how much “thinking” they do before answering. More thinking = more cost per attempt, but usually a more accurate attempt. This is the “make each try better” knob.</p><p><strong>Knob B — how many times you try.</strong> Run the model multiple times and combine the answers. Two main ways to combine (these come straight from how you’d grade multiple answers — a topic for another article):</p><ul><li><strong>Majority vote:</strong> generate many answers, go with whichever shows up most often. Free to do — just count.</li><li><strong>Best-of-N with a grader:</strong> generate many, use a separate “grader” model to pick the best one. More powerful, but the grader costs extra compute.</li></ul><p>So “configure o3/o4-mini within $500” really means: <strong>find the best combination of {which model} × {how hard it thinks} × {how many tries} × {how you combine them} — that stays under $500 and maxes out accuracy.</strong></p><h3>$500 is actually a LOT — and that changes everything</h3><p>Here’s something easy to miss: a single cheap attempt might cost you <em>pennies</em>. So <strong>$500 per question is an enormous budget.</strong> You could afford a huge amount of thinking, or a huge number of tries, or both.</p><p>This tells you what the question is <em>really</em> testing. They’re not asking “how do you save money.” They’re asking “you have generous resources — how do you spend them intelligently to squeeze out maximum accuracy?” The whole game is <strong>spending test-time compute well</strong>, not pinching pennies.</p><h3>The catch: both knobs run out of steam</h3><p>You might think: “Great, huge budget — just crank both knobs to the max!” But here’s the thing both knobs have in common: <strong>diminishing returns.</strong></p><ul><li><strong>More thinking helps… until it doesn’t.</strong> Past a certain point, extra thinking stops adding accuracy. The model has already figured out what it’s going to figure out.</li><li><strong>More tries help… until they don’t.</strong> The 50th attempt usually just repeats what the first 49 already said. Once the answers stop changing, more tries are wasted money.</li></ul><p>Neither knob is “spend infinitely and win.” Each one has a <strong>knee</strong> — a point where money stops buying you accuracy.</p><p>And this leads to the single most important strategic takeaway:</p><blockquote><strong><em>Don’t dump the whole $500 into one knob.</em></strong></blockquote><p>Because both knobs flatten out, blowing your entire budget on one ultra-deep mega-attempt wastes money the moment the thinking plateaus. And blowing it all on thousands of cheap tries wastes money the moment the votes stop changing. <strong>The sweet spot is almost always a blend</strong> — some thinking per attempt, some number of attempts — landing in the middle where you get the most accuracy before either knob taps out.</p><h3>So what’s the actual answer? “I’d measure it, not guess it.”</h3><p>Here’s the honest, grown-up answer: you <em>can’t</em> know the perfect blend just by thinking about it, because it depends on the specific benchmark.</p><p>So you run a small experiment. On a <em>subset</em> of the problems, you try out a bunch of configurations:</p><ul><li>cheap model + tons of tries</li><li>expensive model + a few deep attempts</li><li>various blends in between</li></ul><p>You plot <strong>accuracy vs. dollars spent</strong> for each, find which one gives the most accuracy per dollar before hitting the plateau, lock in that configuration, and then run the full benchmark with it.</p><p>“I’d sweep the settings on a small sample and let the data pick the configuration” is the answer that signals you actually know what you’re doing — instead of confidently guessing.</p><h3>The trade-off they asked about: big-and-expensive vs. cheap-and-many</h3><p>This is the heart of the question, so let’s nail down exactly <em>when each strategy wins.</em></p><h3>When the big expensive model wins</h3><p>Picture a problem so hard that the cheap model gets it wrong <strong>every single time.</strong> Now here’s the trap: running it 1,000 times <em>won’t help.</em> If all fifty (or all thousand) attempts are wrong, having them “vote” just produces a <strong>confident wrong answer.</strong> Fifty wrong people agreeing doesn’t make them right.</p><p>This is the fatal weakness of the cheap-and-many strategy, and it’s worth saying clearly:</p><blockquote><strong><em>Majority vote only works if the model is right at least </em>some<em> of the time.</em></strong></blockquote><p>If the cheap model’s natural tendency is toward a <em>wrong</em> answer, more tries just make it <em>more confidently wrong</em>. For problems that are genuinely beyond the cheap model’s ability, you have no choice — you need the smarter, more expensive brain.</p><h3>When the cheap model with many tries wins</h3><p>Now picture a problem the cheap model <em>can</em> solve — but only sometimes. Say it gets it right 40% of the time. The other 60%? It’s wrong, but its wrong answers are <em>scattered</em> — different wrong guesses each time — while the <em>correct</em> answer keeps showing up again and again.</p><p>This is where majority vote is pure magic. The scattered wrong answers split the vote among themselves, while the correct answer piles up and rises to the top. You just nailed a problem for a <em>fraction</em> of the cost of the big expensive model.</p><p>In cases like this, you genuinely get <strong>more accuracy per dollar</strong> from many cheap tries than from one expensive attempt.</p><h3>The principle that ties it together</h3><p>It all comes down to one question about each problem:</p><ul><li>Is it <strong>within the cheap model’s reach, just unreliable?</strong> → buy more tries.</li><li>Is it <strong>beyond the cheap model entirely?</strong> → buy a smarter model.</li></ul><p>And here’s the kicker: <strong>real benchmarks are a mix of both kinds of problems.</strong> Some are easy-but-flaky, some are genuinely too hard for the small model. That’s <em>yet another</em> reason the best overall strategy is usually a blend — and why running that little experiment to find the blend is time well spent.</p><h3>The whole thing in five sentences</h3><ol><li>$500 per question is a big budget, so the real question is how to spend “test-time compute” wisely — not how to be cheap.</li><li>There are two ways to turn money into accuracy: a smarter model (better per try) or a cheaper model run many times (more tries).</li><li>Both run into diminishing returns, so the smart move is a <em>blend</em>, not maxing out one knob.</li><li>Cheap-and-many wins when the model can solve a problem but inconsistently (voting pulls the right answer to the top); expensive-and-few wins when the problem is beyond the cheap model entirely (because voting can’t rescue a model that’s always wrong).</li><li>Since you can’t know the perfect blend in advance, you find it by experiment — sweep configs on a sample, plot accuracy vs. cost, pick the knee, and run the full benchmark.</li></ol><h3>Why I wrote this</h3><p>I’m working through real-world ML scenario questions to get sharp again, and the fastest way I’ve found to <em>actually</em> understand something is to explain it like I’m teaching it. If this made the idea click for you — mission accomplished. And if you’d spend the $500 differently, I’d love to hear how; that’s the fun of these.</p><p>More breakdowns on the way.</p><p><em>This question was asked in an OpenAI ML interview. I found it (along with a great collection of others) here: </em><a href="https://www.aiofferly.com/career-guide/openai-ml-interview-questions"><em>AIOfferly — OpenAI ML Interview Questions</em></a><em>.</em></p><p><em>If this helped, a clap or a follow means a lot and tells me which topics to break down next.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ccfd919c2c2a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How Do You Grade an AI’s Reasoning? A Plain-English Guide to Process Reward Models]]></title>
            <link>https://medium.com/@shrunalisalian97/how-do-you-grade-a-robots-work-a-plain-english-guide-to-process-reward-models-ac04f8c55e12?source=rss-97aa7b72566b------2</link>
            <guid isPermaLink="false">https://medium.com/p/ac04f8c55e12</guid>
            <dc:creator><![CDATA[Shrunali Suresh Salian]]></dc:creator>
            <pubDate>Sun, 14 Jun 2026 15:35:11 GMT</pubDate>
            <atom:updated>2026-08-29T01:47:27.926Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>The interview question that started this:</strong> <em>“Design a process-reward model to evaluate and rank multiple answer candidates from a reasoning model. How would you balance accuracy vs. compute cost? What metrics would you track?”</em></p><p>When I first read this question, it sounded intimidating. “Process-reward model.” “Rank answer candidates.” It has that flavor of jargon that makes you feel like you’re supposed to already know it.</p><p>So I did what I always do when something sounds scary: I translated it into plain English and rebuilt it from scratch. This article is that translation. By the end, you’ll understand not just <em>what</em> a process reward model is, but <em>why</em> anyone bothered to invent one — and you’ll be able to explain it to a friend over coffee.</p><p>Let’s go!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7d6ywkLltVX5HB9nIiu3SQ.jpeg" /><figcaption>Source: Claude generated</figcaption></figure><h3>First, the setup: a model that shows its work</h3><p>Imagine a really smart math student. You give them a hard problem, and instead of just blurting out an answer, they write out their reasoning line by line:</p><pre>First, I&#39;ll find the area of the rectangle: 4 × 5 = 20.<br>Then I subtract the triangle&#39;s area: 20 − 6 = 14.<br>So the final answer is 14.</pre><p>Modern reasoning models work like this. They “think out loud” on the page. And here’s a useful quirk: if you ask the same model the same question several times, you get slightly different attempts each time — different paths, sometimes different answers. Like asking five students to solve the same problem; you get five worked solutions.</p><p>Now the question becomes: <strong>out of these five attempts, which one is the best?</strong> You need a grader.</p><h3>Two ways to grade: the answer vs. the work</h3><p>Think about how a teacher could grade homework. There are two styles.</p><p><strong>The lazy teacher</strong> flips to the last line, checks if the final answer is right, and moves on. Right answer = full marks. Wrong answer = zero. They never read the actual working.</p><p><strong>The thorough teacher</strong> reads every line. “Good, the area is right… wait, this step is wrong… but somehow you got the right answer anyway?” They grade the <em>process</em>, not just the destination.</p><p>In AI terms:</p><ul><li>The lazy teacher is an <strong>Outcome Reward Model (ORM)</strong> — it only judges the final answer.</li><li>The thorough teacher is a <strong>Process Reward Model (PRM)</strong> — it judges every step of the reasoning.</li></ul><p>The interview question asks about the <em>thorough</em> teacher. And the very first thing to understand is <strong>why you’d ever want one.</strong></p><h3>Why grade the work at all? (The most important idea in this whole article)</h3><p>Here’s the thing about only checking the final answer: <strong>the right answer can come from broken reasoning, and good reasoning can lead to a fumbled final answer.</strong></p><p>Picture a student who makes <em>two</em> mistakes that accidentally cancel each other out and lands on the correct number. The lazy teacher gives them full marks. But that student didn’t actually understand anything — they got lucky. Reward that, and you’re teaching “the path doesn’t matter, just stumble toward the right number somehow.”</p><p>For a reasoning model, <strong>the path is the whole point.</strong> We don’t just want correct answers; we want <em>correct thinking that reliably produces correct answers.</em> That’s why we grade the work.</p><p>There’s a second reason, too. Imagine giving a student feedback only at the very end: “This 20-line proof is wrong.” Wrong <em>where</em>? They have no idea. Now imagine feedback on every line: “Lines 1–14 are perfect, line 15 is where you slipped.” That’s <em>far</em> more useful feedback. Grading each step tells you exactly where things went wrong instead of one vague thumbs-down at the end.</p><p>So: <strong>we grade the process because the reasoning is the product, and step-by-step feedback is far more precise than a single grade at the end.</strong></p><h3>Okay, so how do you actually build this grader?</h3><p>Let’s build the thorough teacher from scratch. Four moves.</p><h3>Move 1: Decide what counts as a “step”</h3><p>Before you can grade steps, you have to define one. Usually it’s just a line or a sentence of reasoning. Simple — but it matters, because how finely you chop up the reasoning decides how many grades you produce and how much work the grader has to do.</p><h3>Move 2: Get training data — i.e., examples of good and bad steps</h3><p>Your grader starts out knowing nothing. To teach it, you need a big pile of reasoning steps, each labeled “good” or “bad.” Two ways to get those labels:</p><p><strong>Option A — hire humans.</strong> Pay people to read thousands of solutions and mark each step. Accurate, but slow and expensive. (This is roughly how some of the famous early datasets in this space were built.)</p><p><strong>Option B — let the model grade itself.</strong> This is the clever trick, and it’s worth slowing down for, because it’s genuinely beautiful.</p><p>Ask yourself: <em>what does it even mean for a step to be “good”?</em></p><p>Here’s the answer the trick is built on: <strong>a step is good if you can still reach the correct final answer from it.</strong></p><p>So here’s what you do. Suppose you’re at step 3 and you want to know if it’s a good step. From the end of step 3, you let the model keep going and finish the problem — not once, but, say, 20 times (remember, each attempt comes out a little different). Then you count how many of those 20 finishes landed on the <em>correct</em> final answer.</p><ul><li>18 out of 20 reached the right answer → step 3 was clearly a strong step. Score it high.</li><li>2 out of 20 → step 3 probably already went off the rails. Score it low.</li></ul><p>You just generated a label <strong>without any human involved</strong> — purely by asking, “does this step lead somewhere good?” It’s like judging a chess move not by gut feeling, but by playing out the rest of the game 20 times and seeing how often you win from there.</p><p>(Quick note for later: those 20 replays <em>per step</em> are expensive. Hold that thought — it comes back when we talk about cost.)</p><h3>Move 3: Train the grader</h3><p>Take an existing language model as your starting point. Show it a step and train it to output a number between 0 and 1 — “how likely is this step to be good?” — matching the labels you gathered in Move 2. That’s standard training. Now you’ve got a model that reads any step and scores it. Done.</p><h3>Move 4: Turn many step-scores into one overall score</h3><p>Here’s a subtlety. Your goal was to <em>rank whole solutions</em> and pick the best. But your grader produces a score for <em>each step</em>. A solution with 8 steps gives you 8 scores. How do you squish 8 numbers into one “how good is this solution overall” number?</p><p>Turns out <em>how</em> you squish them really matters:</p><ul><li><strong>Multiply them all together.</strong> Captures “every single step must be good.” Downside: longer solutions get unfairly punished — multiply eight numbers below 1 and you get a tiny result even if all eight steps were fine.</li><li><strong>Take the minimum (the worst step’s score).</strong> The logic: <em>a chain is only as strong as its weakest link.</em> If one step is garbage, distrust the whole thing. Simple and surprisingly effective.</li><li><strong>Take the average.</strong> Smooth and forgiving — but one disastrous step can hide behind seven good ones.</li><li><strong>Just use the last step’s score.</strong> Don’t. That throws away the entire point and turns your thorough teacher back into the lazy one.</li></ul><p>The honest answer isn’t “the minimum is correct.” It’s: <em>try a couple of these and keep whichever one actually ranks solutions best when you test it.</em> Treat it as a dial you tune, not a fact you memorize.</p><h3>The real tension: being right vs. being cheap</h3><p>This grader is powerful, but it costs money — in three separate places. I like to think of them as three taps you can turn down independently.</p><h3>Tap 1: Making the training labels</h3><p>Remember those 20 replays per step? They add up <em>fast</em>. If you have 10,000 solutions with 8 steps each, and you replay 20 times per step, that’s <strong>1.6 million model runs</strong> just to create your training data. Ouch!</p><p><em>How to turn it down:</em> do fewer replays per step (maybe 8 is enough), or use a smaller, cheaper model to do the replays. There are diminishing returns — going from 8 replays to 50 barely improves the labels but costs you 6× more.</p><h3>Tap 2: How many candidate answers you generate (this is the big one)</h3><p>To pick the best solution, you generate several candidates and grade them. So how many should you generate — 5? 50? 500?</p><p>Here’s the crucial fact: <strong>generating more candidates helps a lot at first, then basically stops helping.</strong> Going from 4 candidates to 16 might noticeably boost your accuracy. But going from 64 to 256 often barely moves the needle while costing 4× more.</p><p>So you don’t pick this number by gut. <strong>You plot accuracy against the number of candidates, find the “knee” where the curve flattens out, and stop there.</strong> That knee <em>is</em> your answer to “how do I balance accuracy and cost.</p><h3>Tap 3: How big the grader is</h3><p>Grading is easier than solving. So your grader doesn’t need to be as big as the model doing the actual problem-solving. A small grader judging a big solver’s work is a perfectly legitimate way to save compute.</p><p>Bonus trick: instead of generating all the candidates fully and <em>then</em> grading them, you can grade <em>as the model writes</em> and cut off the bad ones early — so you never waste compute finishing a solution that already went wrong at step 2. Like a teacher stopping a student mid-exam and saying “you’ve already made a fatal mistake, no need to keep going.”</p><h3>And the biggest-picture trade of all</h3><p>A step-grader (PRM) is more powerful but more expensive than just checking the final answer (ORM). Sometimes, though, the final answer is <em>cheap and easy to check</em> — a math problem with a known answer, or code you can simply run against tests. In those cases, the fancy step-grader might not be worth it; just check the outcome.</p><p>The step-grader earns its cost mainly when the <strong>reasoning itself</strong> is what you care about, or when there’s <strong>no cheap way to verify the final answer.</strong></p><h3>How do you know if it’s actually working? (Metrics)</h3><p>Three questions, each with its own way of measuring.</p><p><strong>1. “Does my grader pick good answers?”</strong> At the end of the day, you care about one practical thing: when the grader picks an answer, is it right? So you test exactly that — generate several candidates, let the grader pick its favorite, and check how often that favorite is actually correct, across hundreds of problems.</p><p>But a number means nothing without something to compare against. So compare it to the <em>free</em> baseline: <strong>majority vote</strong> — just generate several answers and go with whatever shows up most often. No grader, no training, no cost. It’s the “ask the audience” lifeline. If three out of five solutions say “14,” you pick 14.</p><p>Here’s the gut-check: <strong>if your expensive grader can’t beat plain majority voting, you built a whole model for nothing</strong> — you could’ve just counted votes. The grader’s entire job is to be <em>smarter</em> than counting, so majority vote is the bar it has to clear to justify its existence.</p><p><strong>2. “Does my grader judge individual steps correctly?”</strong> Metric 1 only checked the final outcome — but a grader could pick right answers for the <em>wrong reasons</em>, like a student passing a multiple-choice test by lucky guessing. So this metric looks under the hood.</p><p><em>Does it score steps correctly in general?</em> Run it on a held-out pile of steps whose true labels you already know, and check that good steps get high scores and bad steps get low ones.</p><p><em>And the sharper test — does it catch the error in the right place?</em> The whole reason you built a <em>step</em>-grader was to find <em>where</em> reasoning breaks, not just <em>that</em> it broke. So test that directly: take a solution where you know the mistake is on step 5, and ask the grader to find the first bad step. If it says “step 5,” perfect. If it says “step 2,” it senses something’s wrong but can’t pinpoint it — which means it’s failing at its one special job.</p><p><strong>3. “Is it even worth the money?”</strong> Track accuracy <em>per unit of compute</em> — not accuracy on its own. The whole question is about the trade-off, so this is the number that ties everything together.</p><h3>The whole thing in five sentences</h3><ol><li>A reasoning model shows its work, and we want to pick its best attempt out of several.</li><li>We can grade just the final answer (lazy teacher) or grade every step (thorough teacher) — and for reasoning, the steps matter, because the right answer can come from broken logic.</li><li>We can teach a step-grader cheaply by replaying each step many times and asking “does this lead to the right answer?”</li><li>It costs money in three places — making labels, generating candidates, and the grader’s size — and the key trick is that generating <em>more</em> candidates helps only up to a point.</li><li>We measure success by whether the grader beats plain majority voting, whether it spots errors in the right place, and whether all of it is worth the compute.</li></ol><h3>Why I wrote this</h3><p>I’m working through real-world ML scenario questions to sharpen up, and I’ve found that the fastest way to <em>actually</em> understand something is to explain it like I’m teaching it. If you got this far and it made sense — that was the whole goal. If you spot something I got wrong or oversimplified, I’d genuinely love to hear it; that’s how the explanation gets better.</p><p>More of these on the way.</p><p><em>This question was asked in an OpenAI ML interview. I found it (along with a great collection of others) here: </em><a href="https://www.aiofferly.com/career-guide/openai-ml-interview-questions"><em>AIOfferly — OpenAI ML Interview Questions</em></a><em>.</em></p><p><em>If this helped, a clap or a follow means a lot and tells me which topics to break down next.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ac04f8c55e12" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[EMMA: The AI That Drives — and Thinks — Like Us]]></title>
            <link>https://medium.com/@shrunalisalian97/emma-the-ai-that-drives-and-thinks-like-us-840094d2b900?source=rss-97aa7b72566b------2</link>
            <guid isPermaLink="false">https://medium.com/p/840094d2b900</guid>
            <dc:creator><![CDATA[Shrunali Suresh Salian]]></dc:creator>
            <pubDate>Thu, 13 Mar 2025 00:42:27 GMT</pubDate>
            <atom:updated>2025-03-13T00:42:27.249Z</atom:updated>
            <content:encoded><![CDATA[<h3>EMMA: The AI That Drives — and Thinks — Like Us</h3><p><strong>End-to-End Multimodal Model for Autonomous Driving — Waymo</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*A9CoBj6cUB6biL0zV7CahA.gif" /></figure><p>Ever imagined a self-driving car that not only drives but also understands the world around it? That’s what this paper by Waymo is all about!</p><p>Autonomous vehicles aren’t just about getting from point A to point B anymore. The real revolution is in how they <em>think</em>. Enter <strong>EMMA</strong>, an <strong>End-to-End Multimodal Model for Autonomous Driving</strong>, making waves in the AI world.</p><p>This isn’t just another self-driving system — it’s a <strong>radical shift in how autonomous vehicles perceive, plan, and drive</strong>. Instead of treating driving as a set of separate tasks (perception, mapping, planning), EMMA processes everything together — <strong>like a human driver would.</strong></p><h3>🚀 What Makes EMMA Different?</h3><p>Most self-driving systems work like a team of specialists. There’s one module for <strong>seeing the world (perception)</strong>, another for <strong>figuring out the map</strong>, and yet another for <strong>deciding where to go</strong>. Think of it as a relay race — information gets passed between different models.</p><p>EMMA, on the other hand, is like a <strong>solo marathon runner</strong> — it processes everything in a single, unified system. It learns directly from <strong>raw data</strong> instead of relying on pre-processed inputs. This <strong>end-to-end approach</strong> streamlines decision-making and improves accuracy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PxIgJGoc6pnWSkGYOLra5w.png" /><figcaption>Image from paper</figcaption></figure><p>🔍 But if this is such a game-changer, why haven’t we always done it this way?</p><p>Because it’s <strong>hard.</strong> Really hard.</p><p>Only recently have <strong>AI models become powerful enough</strong> to handle this level of complexity. And that’s where <strong>Multimodal Large Language Models (MLLMs)</strong> come in.</p><h3>🧠 Teaching a Car to See, Read, and Think</h3><p>EMMA is built on <strong>Google’s Gemini</strong>, a massive <strong>Multimodal Large Language Model (MLLM)</strong>. Unlike traditional AI models that process <strong>only images or only text</strong>, MLLMs <strong>combine both</strong> — allowing EMMA to interpret <strong>visual scenes, text instructions, and real-time driving data simultaneously</strong>.</p><p>Imagine you’re driving and see a <strong>ball roll into the street</strong>. Even if you don’t see a child, your experience tells you a kid might be running after it.</p><p>EMMA, thanks to its MLLM foundation, <strong>has this kind of world knowledge baked in</strong>. It doesn’t just react to objects — it <strong>anticipates and understands</strong> them.</p><h3>🔗 Chain-of-Thought Reasoning: Thinking Out Loud</h3><p>One of the most fascinating things about EMMA is its ability to <strong>explain its decisions</strong> — a technique called <strong>Chain-of-Thought Reasoning</strong>.</p><p>Instead of making a decision in a “black box,” EMMA:<br> ✅ <strong>Describes the scene</strong><br> ✅ <strong>Identifies key objects</strong><br> ✅ <strong>Explains it’s reasoning before taking action</strong></p><p>It’s like having a <strong>co-pilot that not only drives but also explains every move.</strong> This improves transparency and helps EMMA handle tricky situations better.</p><h3>🎯 Does EMMA Actually Perform Well?</h3><p>The real test for any AI model is how it performs in the <strong>real world</strong>. Researchers tested EMMA on standardized benchmarks like <strong>NuScenes and Waymo OpenMotion</strong>, which are like obstacle courses for self-driving cars.</p><p>And EMMA delivered <strong>state-of-the-art performance</strong> — even outperforming systems with more sensors.</p><p>🚧 <strong>It was even tested on random obstacles like garbage bags — and squirrels.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/970/1*0CuGMsvSx4jotnNUnaUdDw.png" /><figcaption>Image from paper</figcaption></figure><p>Spoiler alert: EMMA knew to avoid them, even though it wasn’t specifically trained for squirrel dodging! 🐿️</p><h3>🏆 The Generalist Model: One AI, Many Tasks</h3><p>One of the most groundbreaking aspects of EMMA is that it’s a <strong>generalist model</strong>. Unlike traditional AI models that specialize in just one task, EMMA:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bLPqE81ipbIc8goPhSoIkA.png" /><figcaption>Image from paper</figcaption></figure><p>✅ Detects <strong>3D objects</strong><br> ✅ Estimates <strong>road layouts</strong><br> ✅ <strong>Plans movements</strong><br> ✅ Understands the entire <strong>driving scene</strong></p><p>It’s not just reacting — it’s thinking ahead, strategizing, and <strong>understanding context</strong> like an experienced driver.</p><p>And here’s the kicker: <strong>Multitasking actually makes EMMA better</strong>. The more tasks it learns, the more it improves across the board.</p><h3>🛑 Challenges: What’s Standing in EMMA’s Way?</h3><p>As exciting as EMMA is, there are still challenges to overcome before we see it <strong>on the open road</strong>.</p><h3>⚡ 1. Computational Power</h3><p>EMMA processes massive amounts of data in real-time — basically running a <strong>supercomputer inside a car</strong>. But <strong>cars have space and energy limitations</strong>, so researchers are working on <strong>model compression</strong> to make EMMA’s AI more efficient.</p><h3>🛑 2. Sensor Limitations</h3><p>Right now, EMMA <strong>relies mostly on cameras</strong>. But cameras struggle in bad weather or low light. Researchers are integrating <strong>LiDAR and radar</strong> to help EMMA “see” better — like giving it <strong>night vision</strong>.</p><h3>✅ 3. Safety &amp; Ethics</h3><p>A self-driving system needs to be <strong>not just smart, but ethical</strong>. Researchers are using <strong>formal verification and simulations</strong> to ensure EMMA makes <strong>safe and responsible driving decisions</strong>.</p><p>This means testing it in virtual environments with <strong>sudden lane changes, jaywalking pedestrians, and extreme weather conditions</strong> — kind of like <strong>driver’s ed for AI.</strong></p><h3>🌍 What Does EMMA Mean for the Future of AI?</h3><p>EMMA isn’t just changing autonomous driving — it’s <strong>a glimpse into the future of AI.</strong></p><p>For years, AI has been <strong>stuck in narrow boxes</strong> — playing chess, translating languages, recognizing objects. EMMA breaks those walls, showing that AI can be:</p><p>✅ <strong>Flexible</strong><br> ✅ <strong>Versatile</strong><br> ✅ <strong>Continuously learning and adapting</strong></p><p>💡 Imagine a future where AI <strong>isn’t just a tool, but a partner</strong> — helping doctors diagnose diseases, assisting teachers in personalized education, and <strong>solving problems we never thought possible.</strong></p><h3>🎯 Final Thoughts: The Road Ahead</h3><p>EMMA isn’t perfect yet, but it’s a <strong>huge leap forward</strong>. Researchers aren’t just rushing to get self-driving cars on the road — they’re taking the time to <strong>get it right</strong>.</p><p>We’re moving from <strong>automation to augmentation</strong> — where AI doesn’t replace humans but <strong>works alongside us</strong>, amplifying our abilities.</p><p>🚀 The future of AI is bright — <strong>as long as we build it responsibly.</strong></p><p>🔗 <strong>What are your thoughts on EMMA? Do you think self-driving cars will be mainstream soon? Drop a comment below!</strong></p><p>Link to paper: <a href="https://arxiv.org/pdf/2410.23262">https://arxiv.org/pdf/2410.23262</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=840094d2b900" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Perception in Motion: The Science Behind Autonomous Vehicle Vision]]></title>
            <link>https://medium.com/@shrunalisalian97/perception-in-motion-the-science-behind-autonomous-vehicle-vision-07f68a263263?source=rss-97aa7b72566b------2</link>
            <guid isPermaLink="false">https://medium.com/p/07f68a263263</guid>
            <dc:creator><![CDATA[Shrunali Suresh Salian]]></dc:creator>
            <pubDate>Thu, 29 Aug 2024 21:36:52 GMT</pubDate>
            <atom:updated>2024-11-22T17:26:22.417Z</atom:updated>
            <content:encoded><![CDATA[<p>The advent of autonomous vehicles is transforming the future of transportation. As these vehicles increasingly populate our roads, they face the challenge of navigating intricate and ever-changing environments where accurately understanding motion and object interactions is essential.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/850/1*llJs6wA3xeJfroGmlkxbCw.gif" /><figcaption>Source: <a href="https://news.mit.edu/2022/machine-learning-anticipating-behavior-cars-0421">https://news.mit.edu/2022/machine-learning-anticipating-behavior-cars-0421</a></figcaption></figure><p>I found the research paper <a href="https://arxiv.org/abs/2309.14491"><strong>Unsupervised 3D Perception with 2D Vision-Language Distillation for Autonomous Driving</strong></a> fascinating, but understanding it requires a deep dive into <a href="https://arxiv.org/abs/2210.08061"><strong>Motion Inspired Unsupervised Perception and Prediction in Autonomous Driving</strong></a>. However, to truly grasp that, one must first explore <a href="https://arxiv.org/abs/2111.01253"><strong>Neural Scene Flow Prior</strong></a>.</p><p>In this article, I aim to guide you through the core concepts in a narrative format, showing how each technology naturally leads to the next. My goal is to help you navigate these research papers with greater ease.</p><p>Please keep in mind, that I’m not an expert — I’ve simply studied a few research papers and want to share what I’ve learned. This is going to be a rather long read, so I recommend grabbing a cup of coffee before you dive in!</p><p>Before diving into the complexities of <strong>Unsupervised 3D Perception with 2D Vision-Language Distillation for Autonomous Driving</strong> and exploring how 3D perception and 2D vision-language distillation integrate within an autonomous vehicle, let’s start by grasping the fundamentals. We’ll begin with an introduction to Scene Flow and explore why it’s significant enough to have inspired two research papers from Waymo, both of which build upon the concept introduced in <strong>Neural Scene Flow Prior</strong>.</p><h3>What is Scene Flow?</h3><p><strong>Scene flow describes the movement of 3D points from one frame to the next.</strong> It is an extension of optical flow, which deals with the motion of pixels in 2D images. For each point in the 3D space, scene flow provides a vector that indicates how and where this point moves.</p><p>Each 3D point has a corresponding scene flow vector f⃗ = ( fx, fy, fz ) where fx, fy, and fz​ represent the motion along the X, Y, and Z axes, respectively. This vector tells us how the point has moved from one frame to the next in a sequence.</p><h4>So, why is scene flow so important?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*jIgqhkA-0pChmD2gMtDKig.gif" /></figure><p>Let’s say you’re driving ahead of an AV and want to change lanes. The AV must accurately perceive and predict your car’s motion to avoid any potential collision. This is where scene flow comes into play. <strong>Scene flow enables the AV to analyze the 3D motion of your car relative to the road and other objects around. It calculates how fast you’re going, in what direction, and how that might change in the next few seconds.</strong> With this information, the AV can decide whether it’s safe to maintain its current speed and lane or whether it needs to adjust its path to ensure there’s no conflict with your movement.</p><h3>Research Paper 1: Neural Scene Flow Prior</h3><p>The paper introduces something called a <strong>Neural Scene Flow Prior</strong> that uses a neural network’s architecture as a new kind of rule or <strong>regularizer</strong> that guides the optimization process during the operation.</p><p><strong>Pros:</strong> Since it is an unsupervised algorithm, it doesn’t require any pre-labeled datasets, making it flexible and easy to deploy in new environments, like autonomous driving. The method can track how points move across multiple frames.</p><p><strong>Cons: </strong>NSFP suffers from underestimating the velocity of moving objects, i.e., false negative flows over pedestrians and inaccurate estimation of fast-moving vehicles. It also introduces excessive false positive flows over static objects (e.g., buildings).</p><h4><strong>Let’s explore the research paper in detail</strong></h4><p>Before deep learning became popular, many computer vision algorithms relied on optimizing mathematical functions during their operation, using strong assumptions or “rules” to guide their predictions.</p><p>With the rise of deep learning, we moved to using supervised learning, where models learn from large sets of labeled data. These models don’t need explicit rules because they learn patterns directly from the data. But there’s a catch: these models only work well in situations similar to their training data. If they encounter something different, they often struggle!</p><p>This paper revisits the scene flow problem but with a twist. Instead of relying on pre-trained models that don’t adapt well to new situations, it introduces a <strong>Neural Scene Flow Prior </strong>that<strong> </strong>uses a neural network’s architecture(Multilayer Perceptrons) on an unlabeled dataset as a new kind of rule or “regularizer” that guides the optimization process during the operation itself, not just during training.</p><blockquote>Inspiration behind Unsupervised Scene Flow Prediction</blockquote><blockquote>The authors drew inspiration from the research paper titled <a href="https://arxiv.org/pdf/1711.10925"><strong>‘Deep Image Prior.’</strong></a><strong> </strong>In traditional learning-based scene flow methods, priors are learned from a large number of examples. However, just as <strong>‘Deep Image Prior’ </strong>demonstrated that the structure of a neural network could capture image priors without any learning, the authors of this work explored whether the same concept could be applied to scene flow. And voila! It worked!</blockquote><h4>Let’s understand how NSFP works</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/200/1*WudRee3qsSiW5sbUswMnbA.gif" /></figure><h4>Problem Definition</h4><p>Imagine S1​ and S2​ are two 3D point clouds captured from a dynamic scene at two different time points t−1 and t.</p><blockquote>What is a point cloud?</blockquote><blockquote>A point cloud is a collection of data points in space, typically representing the external surface of an object or environment. These data points are usually defined by X, Y, and Z coordinates, representing their position in 3D space. Point clouds are generated by 3D scanners, lidar sensors, or other depth-sensing devices, which capture the distance of points from a sensor to the surface of an object or scene.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*1inqstrPPiXQ7jy_X9K89A.gif" /><figcaption>Point Cloud</figcaption></figure><p>These point clouds are generally not in correspondence, meaning that the number of points in each point cloud, |S1| and |S2|, are typically different. Each point in the first point cloud S1 moves to a new position in the second point cloud S2. The movement of each point can be described by a vector, which tells you how much and in what direction the point has moved. Collectively, all these movement vectors form what we call the scene flow.</p><p>A 3D point p ∈ S1 that moves to a new position at time t can be described by a translational vector<strong> f⃗ ∈ R3</strong>, where<strong> p′= p + f⃗. </strong>The collection of flow vectors for all 3D points is</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QSDU56Nxvfe-Y6O13CYKQQ.jpeg" /><figcaption>Image from the paper: Neural Scene Flow Prior</figcaption></figure><p>Scene flow F is the collection of all such flow vectors for every point in S1, capturing the overall motion of the scene from time t-1 to time t.</p><h4>Optimization</h4><p>We want to optimize for a scene flow F that minimizes the distance between the two point clouds, S1 and S2. Given the non-rigidity assumption, meaning objects in the scene can deform, stretch, or move in complex ways (like people walking, cars turning, etc.). A regularization term C is necessary to constrain the motion field and to “smooth out” the solution by discouraging unrealistic movements. Without any constraints, the possible solutions for the scene flow could be too varied or unrealistic.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*crwSMb6VWSYQtjyXjNnFZQ.gif" /></figure><p>For instance, points could move too erratically or in ways that don’t make sense for the actual physical objects in the scene. We therefore solve for scene flow as</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5D8-58JRQpX03NywYH61CA.png" /><figcaption>Image from the paper: Neural Scene Flow Prior</figcaption></figure><p>where D is a function to compute the distance from the perturbed point p by the flow vector f to its closest neighbor in S2. C is a regularizer (<em>e.g</em>., Laplacian regularizer), and λ is a weighting factor for the regularizer.</p><blockquote><em>What is </em>A Laplacian regularizer?</blockquote><blockquote>A Laplacian regularizer is a mathematical tool used in machine learning and computer vision to encourage smoothness in the solution of an optimization problem. It works by penalizing large differences between neighboring values in a dataset, thereby promoting similar values for nearby points, leading to a smoother, more consistent output.</blockquote><h4>Neural Scene Flow Prior</h4><p>Instead of using traditional regularization methods like the Laplacian, <strong>the paper proposes using a neural network as a “neural prior” to regularize the scene flow.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/453/1*tIqFOMgkq4P4zNcXRj3mVA.gif" /></figure><h4><strong>This means the structure of the neural network itself helps guide the flow to be realistic!</strong></h4><p>Thus the parameters are optimized as</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8YFgk6uHK-lui8TddnpDTw.png" /><figcaption>Image from the paper: Neural Scene Flow Prior</figcaption></figure><p>where g is a neural network parameterized by Θ to regularize the scene flow F. The input to g is p, which is the point to be disturbed by the flow. The output of g is f and thus f∗ = g (p; Θ∗). Distance function D is defined as</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*waKnYfXkiyd4wesXcA1dLw.png" /><figcaption>Image from the paper: Neural Scene Flow Prior</figcaption></figure><p>In practice, distance D is used bi-directionally for both point sets, which is equivalent to Chamfer distance.</p><p>The forward flow F moves points from S1​ to S2, but for improved accuracy, the method also considers a backward flow Fbwd​ that tries to reverse this movement, bringing points from S2​ back to S1.</p><p>The backward flow should be consistent with the forward flow, meaning that if you move a point forward and then backward, it should return to its original position.</p><p>The network parameters for the forward flow Θ and the backward flow Θbwd are optimized together:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-HR9ChH-1NECIiZ0suvOEw.png" /><figcaption>Image from the paper: Neural Scene Flow Prior</figcaption></figure><p>where, S1′​ is the shifted point cloud S1 after applying the forward flow, <em>i.e</em>., S1′ = S1+F.</p><p><em>The neural network g used here is a multilayer perceptron (MLP) with ReLU activations. The optimization of the network parameters Θ is done using gradient descent techniques.</em></p><h4>So, have we found the solution to all our AV problems? Turns out no!</h4><p>The NSFP tends to underestimate the velocity of certain moving objects. For example, pedestrians may have motion that is not properly captured by the model, leading to <strong>false negative flows</strong> — where the model fails to detect or correctly estimate the motion.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*8_vPZMljnOGsPHk2cnhpiA.gif" /><figcaption>Source: <a href="https://developer.nvidia.com/blog/generating-ai-based-accident-scenarios-for-autonomous-vehicles/">https://developer.nvidia.com/blog/generating-ai-based-accident-scenarios-for-autonomous-vehicles/</a></figcaption></figure><p>The method also struggles with accurately estimating the velocity of fast-moving vehicles. This leads to errors where the predicted motion of such vehicles is slower than it is. It predicts motion for static objects, like buildings. These <strong>false positive flows</strong> suggest movement where there is none, which introduces noise and reduces the overall accuracy of the scene flow estimation.</p><p>According to <strong>Motion-Inspired Unsupervised Perception and Prediction in Autonomous Driving</strong>, it is hypothesized that these limitations of NSFP arise from its attempt to apply a single global optimization approach to an environment where objects have highly varied velocities and behaviors.</p><h3>Research Paper 2: <strong>Motion-Inspired Unsupervised Perception and Prediction in Autonomous Driving</strong></h3><p>The paper presents a novel approach to unsupervised scene flow prediction by training perception and prediction models to recognize and interpret moving objects that aren’t predefined, all without human supervision. This framework leverages a <strong>self-learned motion flow to generate labels, enabling the system to self-supervise automatically.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/1*j9pY-7SunvwZoTAp892REw.gif" /></figure><p><strong>Pros:</strong></p><ul><li>The approach eliminates the need for human-labeled data by using self-learned motion flow to automatically generate pseudo labels, making it highly scalable and adaptable to new environments, thereby reducing the reliance on costly and time-consuming manual annotation.</li><li>The system is designed to identify a wide variety of moving objects, even those not predefined in the training data. This is crucial for autonomous vehicles operating in dynamic and unpredictable environments where new, unseen objects may appear.</li><li>The enhanced version of the Neural Scene Flow Prior (NSFP++), developed in this method, provides more accurate and scalable scene flow estimation, reducing false positives and improving the overall quality of motion estimation. This is particularly important for detecting and tracking moving objects.</li><li>The use of Auto Meta Labeling (AML) allows the system to automatically create high-quality labels for moving objects, which are then used to train detection and trajectory prediction models. Thus converting the challenge of an open-set learning task into a more supervised-like task.</li><li>By leveraging LiDAR data, the system effectively decomposes the unsupervised learning task into two key steps — scene flow estimation and object proposal generation — resulting in high-quality 3D bounding boxes and tracklets for moving objects.</li><li>The method enables existing behavior prediction models to generalize to all moving objects, without the need for predefining an object taxonomy.</li></ul><p><strong>Cons:</strong></p><ul><li>The method does not localize static objects, which make up a substantial portion of traffic participants in real-world scenarios. By design, the method is class-agnostic and does not assign semantic labels to objects. This is a notable limitation because semantic information is crucial for downstream tasks such as motion planning, where specific safety protocols need to be applied differently depending on the type of traffic participant, like pedestrians, cyclists, or vehicles.</li></ul><h4>Let’s take a closer look at the research paper</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/220/1*NhM_p94QN-YJUaj4PO0Rdw.gif" /></figure><p>Waymo focused on two key objectives:</p><p><strong>(1) Auto Meta Labeling (AML) powered by scene flow estimation and temporal aggregation to generate pseudo-labels for any moving objects in the scene,</strong> and</p><p><strong>(2) Training detection and trajectory prediction models using these auto-generated labels.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WkykgIrKxbISuFg5fF0euA.png" /><figcaption>Image from the paper: Motion Inspired Unsupervised Perception and Prediction</figcaption></figure><p><em>Taking LiDAR sequences as input, the approach begins by determining the motion status of each point, categorizing them as either static or dynamic, and predicting accurate scene flow. Leveraging this motion information, Auto Meta Labeling clusters the points into meaningful semantic groups, links them across frames, and estimates the complete 3D shapes (amodal bounding boxes) of objects. These generated amodal boxes and tracklets then serve as automatic supervision for training 3D detection and trajectory prediction models.</em></p><p><strong>The pipeline has two main modules: (A) Unsupervised scene flow estimation and (B) Auto Meta Labeling</strong></p><h4>A. Neural Scene Flow Prior++</h4><p>The goal is to realize an unsupervised 3D scene flow estimation algorithm that can adapt to various driving scenarios.</p><p><em>(The problem definition is identical to that of NSFP, so it has not been reiterated.)</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/848/1*UFteR0kATaGQBpoxzqeMiQ.png" /><figcaption>Flow quality comparison between NSFP [45] and our NSFP++ over the Waymo Open Dataset. Dashed circles in orange color highlight the major shortcomings suffered by NSFP, i.e., (a) underestimated flow for a fast-moving vehicle, (b)© false positive predictions in the background, and (d) false negative predictions at pedestrians with subtle motion. In contrast, our NSFP++ generates accurate predictions in all these cases.</figcaption></figure><p>The method can be divided into 3 steps:</p><ol><li>Identify static points</li><li>Employ a divide-and-conquer approach to manage different objects by breaking down the scene into semantically meaningful connected components and precisely estimating the local flow for each</li><li>Ensure flow consistency among points within each component</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/862/1*oPjkSWlIbS171rSm3JRdhw.png" /><figcaption>Image from the paper: Motion Inspired Unsupervised Perception and Prediction</figcaption></figure><p><strong>1. Identifying Static Points: </strong>Since the focus of the study was on moving objects, the authors began by strategically removing static points to reduce computational complexity. Recognizing that the ground is a large collection of static points, for which predicting local motion is challenging due to the aperture problem, they chose to eliminate ground points before motion estimation. This was accomplished using a RANSAC-based algorithm.</p><blockquote>What is the aperture problem?</blockquote><blockquote>Imagine you’re standing inside a stationary train and looking out of a small, circular window. Another train on an adjacent track begins to move past your window.</blockquote><blockquote>Through this small window, you can only see a small portion of the train as it moves by. You notice the motion of the train, but because your view is limited to this small window, you can only see the train’s motion in one direction.</blockquote><blockquote>However, you can’t determine if the train is also moving slightly towards or away from you because that movement isn’t perceptible through the small window. This limitation is the <strong>aperture problem</strong>. It’s a situation where, because of a restricted view (like the small window), you can’t accurately determine the full motion of an object. The observed motion is ambiguous, and without a wider view, you can’t tell if the object is moving purely horizontally or if there’s another component to its movement.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*Ka3MCpLtIkgqMCMzYfjwPA.gif" /></figure><p>After removing ground points, which make up the largest collection of static elements, the authors observed that other static objects — such as walls, buildings, and trees — still contributed noise, negatively impacting the quality of the final auto labels. To mitigate this issue, the method further identifies static regions in the scene before conducting scene flow estimation. This is achieved by comparing the Chamfer distance between points in the current frame and those in previous frames. Points are classified as static if the Chamfer distance falls below a specified threshold, thereby enhancing the accuracy of scene flow estimation by minimizing noise from these static objects.</p><p><strong>2. Estimate Local Flow via Scene Decomposition: </strong>After identifying and removing static points, the scene is now divided into two categories: static points and dynamic points. Static points (like buildings or trees) are separated into sets Sst​ and Sst+1 at different time frames t and t+1. Dynamic points (such as moving cars or pedestrians) are stored in sets Sdt and Sdt+1. This separation, not only helps decompose the scene into semantically meaningful connected components, but also substantially reduces false positive flow predictions on static objects.</p><p>The dynamic points Sdt are further broken down into smaller clusters. Each cluster consists of points that are close to each other and likely belong to the same moving object (e.g., a vehicle or a pedestrian). By separating the scene into these connected clusters, the method can target each cluster individually, improving the accuracy of flow estimation for each moving object.</p><p>For each cluster, the algorithm calculates local motion or “flow” by solving an optimization problem. The goal is to find the best model parameters that describe how the points in each cluster move over time. This is done by minimizing the objective function,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Zo_Rt_yLLMQwCvnFUz2oGg.png" /><figcaption>Image from the paper: Motion Inspired Unsupervised Perception and Prediction</figcaption></figure><p>The first two terms ensure that the flow is accurately predicting the movement of points from one frame to the next. The third term, called the <strong>local consistency regularize</strong>, ensures that the flow vectors within each cluster are consistent, meaning that nearby points in the same cluster should move similarly. This regularizer helps maintain coherence in the motion of the cluster, reducing errors. The parameter α (set to 0.1) controls the strength of this regularization.</p><p><strong>3. Box Query Strategy: </strong>Now, given any scenario on the road there will be few moving objects (vehicles) that may move at a higher speed, we need to expand the field of view to find match points in the next frame.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N9gkOOvrr4oVALYAqiYyCg.png" /><figcaption>Image from the paper: Motion Inspired Unsupervised Perception and Prediction</figcaption></figure><p>Given a cluster Ct, representing a moving object, the authors aimed to find the axis-aligned bounding box that tightly covers Ct in the bird’s eye view (BEV). This bounding box is defined as b=[xmin,ymin,xmax,ymax ] where xmin and ymin are the minimum X and Y coordinates of the points in Ct, and xmax and ymax are the maximum X and Y coordinates of the points in Ct.</p><p>Fast-moving objects can travel multiple meters between two LiDAR scans. To satisfactorily capture the points of such objects at time t + 1, the method proposes to expand the box query with axis-aligned buffer distances δx, δy and use b′ = [xmin − δx, ymin − δy, xmax + δx, ymax + δy] to retrieve points from Sdt+1, resulting in Ct+1. Where δx​ and δy​ are the buffer distances added to the bounding box to capture points that might have moved significantly between frames t and t+1.</p><p>Empirically, the maximum value for these buffers is set to 2.5 meters, ensuring that the expanded box can capture all relevant points of a fast-moving object in the next frame. The expanded box query allows the method to accurately predict the future position of a fast-moving object. By capturing the full shape of the object in the next frame, the method ensures that the predicted future positions of the object’s points align well with their actual positions in the next frame.</p><p><strong>3.1 Pruning to Avoid Flow Drift</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/200/1*g7Myl8gcljqIA4L7cZ3_8w.gif" /></figure><p>In crowded scenes, where multiple vehicles are moving close to each other, the expanded box b′ might include points from neighboring objects. This can lead to flow drift, where the predicted motion of one object is inaccurately influenced by the presence of another.</p><p>To address this, the method prunes the retrieved points to keep only the most relevant ones. Specifically, the set of points Ω retrieved by the expanded box b′ is filtered based on their proximity to the centroid (first moment) of the original cluster Ct.</p><p>The method selects the n nearest points from Ω, where n is the minimum of the size of Ω and the original cluster Ct. These selected points are stored in the set Ct+1, representing the relevant points in the next frame.</p><p>Thus, by strategically removing static points and employing methods like the Chamfer distance and scene decomposition, the method significantly improved the accuracy of scene flow estimation. The introduction of the Box Query Strategy, with expanded bounding boxes and careful pruning, ensures precise tracking of fast-moving objects while minimizing errors caused by neighboring objects.</p><h4><strong>B. Auto Meta Labeling Pipeline</strong></h4><p>With the motion signals provided by the unsupervised scene flow module, the authors were able to generate 3D proposals for moving objects without the need for manual labels. They introduced an Auto Meta Labeling pipeline, which uses point clouds and scene flows as inputs to produce high-quality 3D auto labels.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SxgE0C1R028B0K-yB5k6mA.png" /><figcaption>Auto Meta Labeling Pipeline. Source: Motion Inspired Unsupervised Perception and Prediction paper</figcaption></figure><p>The Auto Meta Labeling pipeline is composed of four essential components:</p><p><strong>1. Object Proposal by Clustering:</strong> This step uses spatiotemporal information to group points into visible boxes, thereby defining the concept of objects within each scene.</p><p><strong>2. Tracking:</strong> This component connects the visible boxes of objects across multiple frames, forming tracklets that represent the objects’ movement over time.</p><p><strong>3. Shape Registration:</strong> Here, points from each tracklet are aggregated to reconstruct the complete shape of the object.</p><p><strong>4. Amodal Box Refinement: </strong>This final step transforms the visible boxes into amodal boxes, providing a more comprehensive representation of the objects.</p><p>Let’s understand each of the steps in detail.</p><p><strong>1. Object Proposal by Clustering: </strong>In each scene, given the point cloud locations S and the corresponding point-wise scene flow F, the clustering module segments points into subsets, where each subset represents an object proposal. The bounding box for each subset is then computed to serve as an object representation.</p><p>Traditional clustering methods on point clouds often rely solely on 3D point locations S as the primary feature. However, in autonomous driving datasets, where a significant portion of the points belong to the background, such methods tend to generate numerous irrelevant clusters. Since the focus is on moving objects, the authors leveraged motion signals to reduce false positives. Therefore, a clustering method that incorporates both point locations and scene flows is necessary.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ia1wC2S1vOYs_ZoRd-CYaw.png" /><figcaption>Source: Motion Inspired Unsupervised Perception and Prediction paper</figcaption></figure><p>A straightforward yet effective strategy involves filtering the point cloud by scene flows before the object proposal. Points with a flow magnitude greater than a specified threshold are retained, after which the DBSCAN clustering algorithm is applied to these filtered point sets. This filtering process significantly reduces false positives.</p><p>However, the authors identified a common issue with this approach: closely situated objects often become under-segmented into a single cluster. To address this, they proposed a clustering method that considers both spatial locations and scene flows. After removing points with flow magnitudes smaller than a threshold ∣f∣min, the filtered point locations S′ and point-wise scene flows F′ are obtained. DBSCAN is then applied separately to S′ and F′, resulting in two sets of clusters. A point may fall into different subsets based on these two clustering methods due to its location and motion. The final clusters are formed by intersecting the subsets obtained from the location-based and flow-based clusterings. This ensures that two points are clustered together only if they are close in both location and motion.</p><p>Once the cluster label for each point is established, the concept of an object is defined by a bounding box that covers each cluster. Given the partial observation of objects within a single frame, only boxes that tightly cover the visible part are generated at this stage, denoted as Bvis={bk}. Without relying on object semantics, motion information is used to determine the heading of each box. The average flow fˉk​ of each cluster ck​ is computed, and the 7 DoF bounding box bk​ surrounding ck is determined by minimizing the area on the xy-plane along the chosen heading direction, which is parallel to fˉk.</p><p><strong>2. Multi-Object Tracking: </strong>In the multi-object tracking process, the tracking module connects the visible boxes Bvis​ to form object tracks. Following the tracking-by-detection paradigm, the authors used Bvis​ for data associations and employed a Kalman filter for state updates. However, instead of relying on the Kalman filter to estimate object speeds, the tracking module utilized the estimated scene flows during the association process. At each association step, previously tracked boxes are advanced using the scene flows and then matched with the boxes in the subsequent frame.</p><blockquote>Kalman filter is a widely used algorithm in tracking systems that estimate the state of a moving object over time by considering noisy measurements.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*21JI6_5U7hlxwBac7Rm8LA.gif" /><figcaption>To read more about Kalman filter: <a href="https://medium.com/self-driving-cars/all-about-kalman-filters-8924abe3aa88">https://medium.com/self-driving-cars/all-about-kalman-filters-8924abe3aa88</a></figcaption></figure><p>In traditional tracking, the<strong> Kalman filter predicts the future position of an object based on its current state (position, velocity, etc.).</strong> The Kalman filter is used to update the state of each tracked object, refining its estimated position and velocity based on new observations (the detected bounding boxes).</p><p><strong>Unlike traditional methods that rely solely on the Kalman filter to estimate the object’s speed and future position, the paper advances the previously tracked bounding boxes using the scene flows.</strong> Scene flows represent the actual motion of points in the scene, providing more accurate information about how objects are moving.</p><p>After advancing the bounding boxes, the module matches these advanced boxes with the detected boxes in the next frame. This ensures a more accurate association of objects between frames, leading to better tracking performance, especially in dynamic and complex environments.</p><p><strong>3. Shape Registration and Amodal Box Refinement: </strong>In autonomous driving, as the object moves, the observed views of the object change over time, allowing for the aggregation of temporal data to achieve a more complete perception of each object.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S43shz5OFK7DKyILm4c0Mw.png" /><figcaption>Source: <a href="https://blogs.nvidia.com/blog/lidar-sensor-nvidia-drive/">https://blogs.nvidia.com/blog/lidar-sensor-nvidia-drive/</a></figcaption></figure><p>To facilitate this temporal aggregation, the authors proposed a shape registration method that builds upon the Iterative Closest Point (ICP) algorithm.</p><blockquote>What is Iterative Closest Point (ICP)?</blockquote><blockquote>The Iterative Closest Point (ICP) algorithm is a widely used method in computer vision and robotics for aligning two sets of point clouds. The goal of ICP is to find the best transformation (rotation and translation) that minimizes the distance between corresponding points in the two point clouds, effectively aligning one point cloud with the other.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/853/1*G1a80wrPWUEJyvrgIrnO-w.gif" /><figcaption>Source: <a href="https://www.robot-learning.uk/hybrid-icp">https://www.robot-learning.uk/hybrid-icp</a></figcaption></figure><p>The performance of ICP is highly sensitive to the initialization of transformations. During the clustering process, the headings of all visible boxes within each track were already determined. The difference in headings between the source and target point sets provides a rotation initialization​​ for ICP.</p><p>In autonomous driving scenarios, shape registration across a sequence of observations presents unique challenges: (a) objects may move with significant displacements in the world coordinate system; (b) many observations of objects are sparse due to their distance from the sensor or heavy occlusions. These challenges make it difficult to register points from different frames accurately.</p><p>To address this issue, the authors employed a grid search to find the optimal translation for aligning the source (from frame A) and target (from frame B) point sets. The grid, or search range, is defined by the size of the bounding box in the target frame. The translation Tj corresponding to different grid points is initialized, and the best registration result is selected from these options.</p><p>Through this sequential process, partial views of an object across a track are aggregated into a more complete point set, which often approximates the size of the amodal boxes. A bounding box is then computed around the target point set, similar to the process used in the object proposal stage. During registration, the transformation from each source point set to the target is estimated, allowing the target bounding box to be propagated back to each scene by inverting the transformation matrices. This results in the final 3D amodal bounding boxes for the detected objects.</p><p>The Shape Registration and Amodal Box Refinement process is designed to overcome the limitations of single-frame LiDAR data by leveraging multiple observations over time. Through the careful application of ICP, initialized by heading information and enhanced by grid search, the system aggregates partial views into a complete 3D shape. This process results in the creation of 3D amodal bounding boxes that more accurately capture the full extent of objects in the scene, which is crucial for reliable object detection and tracking in autonomous driving.</p><p>If you’ve been with me this far, congratulations! We’ve just completed our exploration of the second paper, <strong>Motion Inspired Unsupervised Perception and Prediction.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*mYEsZXNDepFCPMHsDs8pfQ.gif" /><figcaption>Source: <a href="https://in.pinterest.com/pin/405042560236056820/">https://in.pinterest.com/pin/405042560236056820/</a></figcaption></figure><h3>Research Paper 3: Unsupervised 3D Perception with 2D Vision-Language Distillation for Autonomous Driving</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j-eM4rM8Ty5zHsihm9L6tw.png" /><figcaption>An illustration of three interesting urban scene examples of open-vocabulary perception.</figcaption></figure><p>Unlike the last approach, which typically generates class-agnostic auto labels limited to moving objects, this method is capable of handling both static and moving objects in an unsupervised manner. Additionally, it can produce open-vocabulary semantic labels through the use of vision-language knowledge distillation.</p><p><strong>Pros:</strong></p><ul><li>UP-VL introduces semantic-aware unsupervised detection for objects in any motion state.</li><li>UP-VL enables 3D open-vocabulary detection of novel objects in the wild, with queries specified by users at inference time, therefore removing the need to recollect data or re-train models.</li></ul><p><strong>Cons:</strong></p><p>By incorporating a pre-trained vision-language model, <strong>UP-VL not only generates higher-quality auto labels for objects in any motion state but also introduces semantic-aware detection.</strong> This breakthrough allows the system to detect and track all traffic participants, regardless of their speed or movement, and to leverage open-vocabulary features that enable flexible querying of the detector’s outputs using text prompts.</p><p><strong>Let’s take a moment to recap the previous method…</strong></p><p>Their approach is designed specifically for moving objects. It begins by taking LiDAR sequences as input and removing ground points. The scene is then segmented into individual connected components or point clusters. The method calculates the local flow between pairs of point clusters from two adjacent frames, retaining only those clusters that exceed a predefined speed threshold. These clusters are then tracked across frames, with points aggregated to create a more complete view of each object. This process ultimately leads to the generation of accurate 3D amodal bounding boxes, which can serve as auto labels for training 3D perception models.</p><p>Two significant drawbacks:</p><ol><li>it only handles moving objects, leaving static objects unaddressed</li><li>it cannot generate semantic information, limiting its overall usefulness for comprehensive scene understanding.</li></ol><h4>Overview of the proposed UP-VL framework</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*demlZOShraQF41a7OFR_Jg.png" /><figcaption>Image from the paper: Unsupervised 3D Perception with 2D Vision-Language Distillation for Autonomous Driving</figcaption></figure><p>During training, the proposed method leverages multi-modal inputs — including LiDAR, camera, and text — to produce high-quality auto supervision through <strong>Unsupervised Multi-modal Auto Labeling. </strong>This process generates 3D point-level features, 3D object-level bounding boxes, and tracklets. <strong>These auto labels are subsequently used to supervise a class-agnostic, open-vocabulary 3D detector.</strong> Additionally, <strong>the 3D detector distills features extracted from a pre-trained 2D vision-language model.</strong></p><p>At inference time, the trained 3D detector outputs class-agnostic bounding boxes and per-point features within the embedding space of the pre-trained vision-language model. The text encoder is then used to map user queries to the embedding space, where per-point similarity scores are computed between the predicted features and the text embeddings (with cosine similarity represented by ⊗). These per-point scores are aggregated to assign semantic labels to the bounding boxes.</p><p><strong>Unsupervised Multi-modal Auto Labeling</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/596/1*ypdubHD51yeThGJFKeNMIQ.png" /><figcaption>Overview of our unsupervised multi-modal auto labeling approach. Source: Unsupervised 3D Perception with 2D Vision-Language Distillation for Autonomous Driving</figcaption></figure><p>The pipeline first extracts vision-language and motion features from multiple modalities, then proposes tracks, and completes bounding boxes of objects. The resulting pointwise VL features, 3D bounding boxes, and tracklets will serve as automatic supervisions to train the perception model.</p><p><strong>Feature Extraction: </strong>As the first step in this approach, the process begins by extracting open-vocabulary features from all available camera images and then transferring these 2D features to 3D LiDAR points using known sensor calibrations. At each time step, a set of images {Ik ∈ R Hk × Wk × 3} is captured by k cameras, where Hk and Wk represent the image dimensions for each camera k. Concurrently, a collection of point clouds {Pt ∈ R Nt × 3 } is captured using LiDAR sensors, with Nt​ denoting the number of points at time t.</p><p>A pre-trained open-vocabulary 2D image encoder Eimg​ is employed to extract pixel-wise visual features for each image, represented as {Vtk ∈ R Hk × Wk × D }, where D is the feature dimension. The mapping between 3D LiDAR points and their corresponding image pixels is then established using the calibration data from the cameras and LiDAR sensors. Once this mapping is complete, each 3D point is associated with its corresponding image feature vector, resulting in vision-language features for all 3D points as Fvlt ∈ R Nt × D.</p><p>In addition to these features, the approach leverages motion signals as a critical representation, significantly enhancing the identification of moving objects in open-set environments.</p><p><strong>Bounding Box Proposal Generation: </strong>At each time step, the system generates initial bounding box proposals by clustering 3D points. These boxes, denoted as Bvis, represent the visible portions of objects and are parameterized by their center coordinates, dimensions, and headings. The clustering is based on a combination of point locations, scene flow, and vision-language features.</p><p>To ensure flexibility in generating auto labels, the system allows for the selection of points based on their speed, using a velocity threshold ϵ. For capturing all objects, regardless of their motion state, this threshold can be set to zero.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*nVrchQ5wbWuTJey7BjoDjg.gif" /></figure><p>A significant challenge in auto-labeling is distinguishing relevant traffic participants from irrelevant scene elements like streets or fences. To address this, the system uses a text encoder to identify and exclude points associated with known background categories. A binary mask, Mbg, is applied to eliminate clusters that are likely background.</p><p>Finally, the system clusters the remaining points into neighboring regions, calculates the tightest bounding boxes around these clusters, and discards any box with a high ratio of background points. This results in a set of initial bounding box proposals, though these boxes may underestimate the full object dimensions due to occlusions and data sparsity.</p><p><strong>Amodal Auto Labeling (From previous paper): In autonomous driving, downstream perception tasks require amodal bounding boxes that encompass both the visible and occluded parts of objects. </strong>To achieve this, the system transforms visible-only proposals into amodal auto labels by adopting a tracking-by-detection approach with Kalman filter state updates. This approach links all object proposals over time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/251/1*QhbuZILtkhTsamNhUzCZkA.gif" /><figcaption>Source: <a href="https://developer.nvidia.com/blog/drive-labs-how-localization-helps-vehicles-find-their-way/">https://developer.nvidia.com/blog/drive-labs-how-localization-helps-vehicles-find-their-way/</a></figcaption></figure><p>Once the proposals are linked into tracks,<strong> shape registration is performed using the Iterative Closest Point (ICP) algorithm. </strong>The intuition here is that different viewpoints offer complementary information, and by aggregating these registered points over time, a complete shape of the object can be reconstructed. A new bounding box is then fitted to this aggregated point set, resulting in the amodal box that covers the entire object, both visible and occluded parts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2ekEHpvUyi0P0OpjC2cqNw.png" /><figcaption>Source: Motion Inspired Unsupervised Perception and Prediction</figcaption></figure><p>The process then involves undoing the registration to map the aggregated points back to individual frames, replacing the original visible box proposals with the new amodal boxes. This produces the final auto-labeled 3D boxes and corresponding tracklets.</p><p>To address any noise introduced during background filtering, point cloud registration, and temporal aggregation — such as tiny, sizable, or overlapping boxes — non-maximum suppression (NMS) is applied to clean up the auto labels. The resulting set of unsupervised amodal auto labels, along with their track IDs and extracted vision-language embeddings, are then used to train an open-vocabulary 3D object detection model.</p><h4>Open-vocabulary 3D Object Detection</h4><p>The method aims to train a 3D object detector capable of localizing objects and assigning open-vocabulary semantic labels without relying on any 3D human annotations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7U1Se7QMWZZW4qHvvmigDA.png" /><figcaption>Source: <a href="https://developer.nvidia.com/blog/drive-labs-how-localization-helps-vehicles-find-their-way/">https://developer.nvidia.com/blog/</a></figcaption></figure><p><strong>1. Model Architecture: </strong>The object detection process is divided into two tasks: <strong>class-agnostic object localization and semantic label assignment.</strong></p><ul><li><strong>Class-Agnostic Localization:</strong> A branch is added to the 3D point cloud encoder backbone to predict 3D bounding box parameters, including the center, dimensions, and heading. A binary classification branch is also added to output a foreground/background objectness score for each box.</li><li><strong>Supervision:</strong> The unsupervised auto labels generated earlier are used as ground-truth data to supervise the bounding box regression and classification tasks.</li><li><strong>Flexibility:</strong> The pipeline is independent of specific 3D point-cloud encoders and detection paradigms, making it adaptable to various detection frameworks. In this case, an anchor-based PointPillar backbone is used, with Huber loss for box regression and Focal Loss for objectness classification to have a fair comparison with prior works.</li></ul><p><strong>2. Vision-Language Knowledge Distillation:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/330/1*rZCvUAvdqol-I3YIfExLFQ.gif" /></figure><ul><li><strong>Feature Distillation:</strong> The 3D detector distills semantic knowledge from the per-point vision-language features extracted by the auto-labeling pipeline.</li><li><strong>New Branch:</strong> A new linear branch is added to predict per-point features in the vision-language embedding space.</li><li><strong>Feature Concatenation:</strong> The voxelized features from the backbone are scattered back into the points and concatenated with the input features (3D point locations, LiDAR intensity, and elongation features).</li><li><strong>Training:</strong> The network is trained to predict the vision-language feature vector for each point, with a cosine distance loss added to the training objective. This loss, combined with the bounding box regression and objectness classification losses, forms the final training objective.</li></ul><p><strong>3. Open-Vocabulary Inference:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/200/1*aOEqdxbKyPYj8aGhpURH7g.gif" /></figure><ul><li><strong>Inference Process:</strong> During inference, the detector localizes objects in a class-agnostic manner and predicts vision-language features for all LiDAR points.</li><li><strong>Semantic Assignment:</strong> The pre-trained 2D vision-language model maps text queries to a shared embedding space. The model then computes the cosine similarity between these text query embeddings and the predicted vision-language features for each 3D point.</li><li><strong>Majority Voting:</strong> Each point is associated with the category that has the highest cosine similarity, and the most common category among the points in each bounding box is assigned to that box.</li><li><strong>Efficiency:</strong> The approach does not require images during inference, as the image encoder features have already been distilled into the point cloud. The only added computation is a simple linear layer for predicting per-point vision-language embeddings, which is negligible in terms of computational overhead.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wzzYSYm6cBq_it5LDNDmgA.png" /><figcaption>Source: Unsupervised 3D Perception with 2D Vision-Language Distillation for Autonomous Driving</figcaption></figure><p>This approach generates class-agnostic amodal box annotations and per-point semantic features, enabling the identification and tracking of open-set traffic participants. The pipeline was evaluated on the Waymo Open Dataset, achieving strong results in open-vocabulary 3D detection, with categories specified during inference via text queries.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tFXG6Y79wi6YiyAY3byxBA.jpeg" /><figcaption>Source: <a href="https://developer.nvidia.com/blog/drive-labs-how-localization-helps-vehicles-find-their-way/">https://developer.nvidia.com/blog/</a></figcaption></figure><p>Collectively, these works highlight the progress and ongoing challenges in developing scalable, unsupervised 3D perception systems for autonomous driving. By integrating multi-sensor data, advanced auto-labeling techniques, and vision-language models, these methods pave the way for more adaptable and efficient perception systems, ultimately contributing to safer and more reliable autonomous vehicles.</p><p>References:</p><ol><li>Unsupervised 3D Perception with 2D Vision-Language Distillation for Autonomous Driving</li><li>Motion-Inspired Unsupervised Perception and Prediction in Autonomous Driving</li><li>Neural Scene Flow Prior</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/220/1*lDD31y6nFPnjCbmXFLrm3A.gif" /></figure><p>Thanks for reading! I’d love to hear your feedback, so feel free to share your thoughts or ask any questions.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=07f68a263263" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Casting Spells with Python: Building a Hangman Game for Harry Potter Fans]]></title>
            <link>https://medium.com/@shrunalisalian97/casting-spells-with-python-building-a-hangman-game-for-harry-potter-fans-b4f02b6acdb9?source=rss-97aa7b72566b------2</link>
            <guid isPermaLink="false">https://medium.com/p/b4f02b6acdb9</guid>
            <dc:creator><![CDATA[Shrunali Suresh Salian]]></dc:creator>
            <pubDate>Fri, 17 May 2024 18:09:55 GMT</pubDate>
            <atom:updated>2024-05-17T18:10:56.500Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*sMYMGmggmmZNdcyqB2gtoQ.gif" /></figure><p>If you’re a fan of the wizarding world of Harry Potter, get ready to cast some spells! In this article, we’ll explore how to combine the timeless game of Hangman with the magical universe of Harry Potter using the power of Python programming.</p><p>As an avid fan of both coding and the Harry Potter series, I’ve always been fascinated by the idea of bringing these two worlds together. After all, what could be more exciting than guessing spells from the beloved books while honing your Python skills? That’s why I decided to embark on a coding adventure and create a Harry Potter-themed Hangman game from scratch.</p><h4>Let’s get to the code …</h4><pre>def get_valid_words(words):<br>    word = random.choice(words) # choses a word randomly from the given list<br>    while &quot;-&quot; in word or &quot; &quot; in word:<br>        word = random.choice(words)<br>    return word.upper()</pre><p>This function takes a list of words as input and returns a single valid word for the Hangman game. It first selects a random word from the list using random.choice(words). Then, it checks if the chosen word contains any hyphens (-) or spaces (). If it does, it keeps randomly selecting a new word until it finds one without hyphens or spaces. Finally, it converts the valid word to uppercase using word.upper() and returns it.</p><pre>def main():<br>    # computer has to randomly choose a word and the user has to guess a letter in that word<br>    word = get_valid_words(words)<br>    word_letters = set(word)<br>    alphabet = set(string.ascii_uppercase)<br>    used_letters = set() # letters that the user has guessed<br>    attempts = 6<br><br>    while len(word_letters) &gt; 0 and attempts &gt; 0:<br><br>        word_list = [letter if letter in used_letters else &quot;-&quot; for letter in word]<br>        print(&quot;Welcome to Harry Potter Hangman Spell Game: &quot;, &quot; &quot;.join(word_list))<br><br>        # getting user input<br>        user_letter = input(&quot; Guess a letter: &quot;).upper()<br>        if user_letter in alphabet - used_letters:<br>            used_letters.add(user_letter)<br>            if user_letter in word_letters: <br>                word_letters.remove(user_letter)<br>            else: <br>                attempts -=1 # decrease number of attempts if wrong guess<br>                print(f&quot;Wrong guess you have {attempts} attempts left&quot;)<br>        elif user_letter in used_letters:<br>            print(&quot; Letter already used&quot;)<br>        else:<br>            print(&quot;Invalid input&quot;)<br>        print(&quot; You have used these letters: &quot;,&quot;, &quot;.join(sorted(used_letters)))<br><br>    if attempts == 0:<br>        print(&quot;Game over. The word is {}&quot;.format(word))<br>    else:<br>        print(&quot;Congrats! You have guessed the word {}&quot;.format(word))</pre><p>This is the main function that runs the Hangman game. It starts by calling the get_valid_words function to randomly select a valid word for the game. It then initializes some variables:</p><ul><li>word_letters: a set containing all the unique letters in the chosen word.</li><li>alphabet: a set containing all uppercase letters in the alphabet.</li><li>used_letters: an empty set to store the letters guessed by the user.</li><li>attempts: the number of attempts the user has, initially set to 6.</li></ul><p>The game loop runs as long as there are still unguessed letters in the word (len(word_letters) &gt; 0) and the user has remaining attempts (attempts &gt; 0).</p><p>Inside the loop, there’s code to:</p><ul><li>Display the current state of the word, with unguessed letters shown as -.</li><li>Prompt the user to guess a letter.</li><li>Check if the guessed letter is valid and hasn’t been used before.</li><li>If the guessed letter is correct, remove it from word_letters.</li><li>If the guessed letter is incorrect, decrement the attempts count.</li><li>Display appropriate messages based on the user’s input and the game state.</li></ul><p>The loop continues until the user correctly guesses all the letters in the word or runs out of attempts.</p><p>After the loop, the code displays the final message based on whether the user won or lost the game.</p><pre>if __name__ == &quot;__main__&quot;:<br>    main()</pre><p>This line ensures that the main function is only executed when the script is run directly (not imported as a module). It&#39;s a common Python idiom to allow the script to be both executable and importable as a module.</p><h4>Guessing Spells: A Live Demo of the Harry Potter Hangman Game</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XseQ0TgMOGWx6ThNJW22yw.png" /></figure><p>As you can see in the demo, the game starts by randomly selecting a spell word from the Harry Potter universe. The player then has to guess the letters in the word one by one to reveal the full spell before running out of attempts.</p><p>With each incorrect guess, the game provides feedback on the remaining attempts and displays the letters already guessed. Once the player correctly identifies all the letters or runs out of attempts, the game reveals the word and declares the outcome.</p><p>This interactive experience not only tests your knowledge of Harry Potter spells but also adds an engaging twist to the classic Hangman game. The command-line interface keeps things simple, allowing players to focus on the thrill of guessing the magical incantations.</p><p>Whether you’re a die-hard Potterhead or just someone looking for a fun coding challenge, this Hangman game offers an entertaining way to immerse yourself in the wizarding world while honing your Python skills.</p><p>Github: <a href="https://github.com/shrunalisalian/Harry_Potter_Hangman_Spells">https://github.com/shrunalisalian/Harry_Potter_Hangman_Spells</a></p><p>Reference: <a href="https://www.youtube.com/watch?v=cJJTnI22IF8&amp;t=322s">https://www.youtube.com/watch?v=cJJTnI22IF8&amp;t=322s</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b4f02b6acdb9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unveiling the Emotions Behind Content Consumption using custom Deep Image Classifier]]></title>
            <link>https://medium.com/@shrunalisalian97/decoding-viewer-engagement-unveiling-the-emotions-behind-content-consumption-b34c4131fb23?source=rss-97aa7b72566b------2</link>
            <guid isPermaLink="false">https://medium.com/p/b34c4131fb23</guid>
            <dc:creator><![CDATA[Shrunali Suresh Salian]]></dc:creator>
            <pubDate>Sun, 30 Jul 2023 19:10:49 GMT</pubDate>
            <atom:updated>2023-08-18T13:56:10.164Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XRsEJY4WWN0gPD3leiIxMQ.png" /><figcaption>When does a customer sign out from Netflix?</figcaption></figure><p>In an era dominated by streaming services and Over-the-Top (OTT) content, the battle for viewer attention has never been more intense. As content creators and platforms strive to captivate audiences, a question lingers in the minds of media enthusiasts and data scientists alike: How can we truly understand what keeps viewers glued to their screens and enthralled by the content they consume?</p><p>Emotions play an undeniable role in our viewing experience. Joy, excitement, fear, or boredom can dictate whether we remain engaged or swiftly move on. Recognizing this, I embarked on a project that harnessed the power of deep learning to decode viewer engagement. The goal was ambitious yet rewarding: to build a custom deep learning model capable of discerning viewers’ emotional responses based on their facial expressions and visual cues.</p><h4>All about the data…</h4><p>In the course of this project, I have leveraged two key technologies: a tailor-made deep learning model and the advanced YOLOv8 Image Classification model. The issue I faced while working on this project was in retrieving the dataset. I couldn’t find any directly available dataset of human expressions/emotions on the internet. In case you do know about a dataset that could be used for this project, let me know in the comments!</p><p>I used the <a href="https://chrome.google.com/webstore/detail/download-all-images/nnffbdeachhbpfapjklmpnmjcgamcdmm">Download All Images</a> google chrome extension and downloaded images for human emotions happy, sad, angry, frustrated, bored, yawning, sleepy, fatigue, tired, engrossed, excited, smiling, giggling, laughing, shocked, scared, fearful, distracted, uninterested, and disgusted. Feel free to add more human emotions to your dataset!</p><h4>System Setup and Installations</h4><p>Since we are dealing with an image dataset, using a CPU for training will be time consuming. Hence, I have made use of Google Colab’s free GPU. In order to use the GPU you have to keep a few things in mind. Make sure that the you have the appropriate CUDA and cuDNN versions installed depending on the version of Tensorflow that you will be using. Use the below link to find what version works for your system.</p><p><a href="https://www.tensorflow.org/install/source">Build from source | TensorFlow</a></p><p>If you do not have the correct installations, your terminal will throw “Out of Memory” Error, which means that you require/are using more memory than what you have. This does not mean you purchase a more powerful GPU, most of the times it is because you have installed incorrect versions of CUDA and cuDNN.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*KbmYdVYCc6bmi3AA8Htsvg.gif" /><figcaption>While working on my first deep learning project this error gave me nightmares 😂</figcaption></figure><p>There are a few libraries we need before we proceed</p><pre>!pip install tensorflow tensorflow-gpu opencv-python matplotlib</pre><p>Sometimes when we use the GPU for our project, the GPU ends up using all the available memory which can lead to an “Out of Memory” Error. Hence,</p><pre>gpus = tf.config.experimental.list_physical_devices(&#39;GPU&#39;)<br>for gpu in gpus:<br>  tf.config.experimental.set_memory_growth(gpu, True)</pre><h4>Removing Dodgy images</h4><p>When you download images using the Download all Images extension, you might end up downloading vectors etc, therefore delete everything lesser than 10KB in size. After you do this, we need to make sure that our input image files are of the correct format for processing.</p><pre>data_dir = &#39;data/train&#39; # variable that points to our data directory<br>image_exts = [&#39;jpeg&#39;,&#39;jpg&#39;,&#39;png&#39;,&#39;bmp&#39;]<br><br>for image_class in os.listdir(data_dir):<br>  for image in os.listdir(os.path.join(data_dir, image_class)):<br>    image_path = os.path.join(data_dir, image_class, image)<br>    try:<br>      img = cv2.imread(image_path)<br>      tip = imghdr.what(image_path)<br>      if tip not in image_exts:<br>        print(&quot;Image not in ext list {}&quot;.format(image_path))<br>        os.remove(image_path)<br>    except Exception as e:<br>      print(&#39;Issue with image {}&#39;.format(image_path))</pre><p>Here, we list out all the image files in the data directory and check whether the image file extensions are included in the list of image extensions that our model works on. If not, we remove those images from the data directory.</p><p>Let’s check for random sample images in the directory now…</p><pre>sample_img = cv2.imread(os.path.join(&#39;data&#39;,&#39;train&#39;,&#39;interested&#39;,&#39;19eedf58c6a884eaec995907d3b4fe95.jpg&#39;))<br>plt.imshow(sample_img)</pre><p>Output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/552/1*wWzJTb9h138JOSh6Q4ZtiQ.png" /><figcaption>But why does this boy look so blue🤔</figcaption></figure><p>That’s because OpenCV reads images in BGR format while matplotlib expects it to be in RGB!</p><pre>plt.imshow(cv2.cvtColor(sample_img, cv2.COLOR_BGR2RGB))<br>plt.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/552/1*tAoT0RhFdq-HddpDMi8R2Q.png" /><figcaption>Perfecto!</figcaption></figure><h4>Load Data</h4><p>Tensorflow has a dataset API</p><pre>tf.data.Dataset</pre><p>It allows you to built a data pipeline, therefore rather than loading everything into memory to begin with, it allows you to built a data pipeline. This helps you to scale at much larger dataset with a repeatable set of steps to apply to your data.</p><p>We are going to use it a little differently, rather than using the Dataset API directly, we will use a Keras utility.</p><pre># building our data pipeline<br>data = tf.keras.utils.image_dataset_from_directory(&#39;data/train&#39;)</pre><p>This builds an image dataset for you on the go, that means, you don’t need to build the labels or classes and it will do a bunch of preprocessing like resizing images to 256x256, batch size is 32, it shuffles the data, the color mode is in RGB, you can also create a validation set.</p><p>Now, this isn’t a dataset that is preloaded into memory. It is a generator. So on the fly we need to go and grab the data that we want. The easiest way to do that is by using a numpy iterator.</p><pre># allowing to access data pipeline by looping through it<br>data_iterator = data.as_numpy_iterator()</pre><p>This allows us to access the generator from our data pipeline. After this we can get consecutive batches using .next() method</p><pre># accessing data pipeline (getting batches)<br>batch = data_iterator.next()</pre><p>There are 2 parts to “batch” — images from our directory loaded into the memory in the form of set of numpy array and labels.</p><h4>Preprocessing Data</h4><p>When you load images of representation of a number of channels which are going to be BGRfor OpenCV and RGB for tensorflow, it’s going to be of values from 0 to 255.</p><p>While building deep learning models ideally you want the image values to be as small as possible to help you optimise faster. Hence, we divide each of the pixel values by 255 so that we get values between 0 and 1.</p><p>We are using a data pipeline, so we can’t go and do this every single time we load up a batch. What we can do is, do it as we load in the data through the data pipeline, using the data pipeline capability.</p><pre>data = data.map(lambda x,y: (x/255,y))<br>scaled_iterator = data.as_numpy_iterator()<br>batch = scaled_iterator.next()<br>batch = scaled_iterator.next()</pre><p>Inside the data pipeline we have function called “map”which allows us to apply a particular type of transformation as our data is being preprocessed through the data pipeline. This means that when we go and pre-fetch the data it will do the transformation as well. When we access our batch we get x — images(independent features) and y — labels (target variable).</p><h4>Splitting Data</h4><pre>len(data) # total number of batches<br><br># establishing dataset sizes <br>train_size = int(len(data)*.7) # 70% data for training<br>val_size = int(len(data)*.2) # 20% for validation<br>test_size = int(len(data)*.1) # 10% for testing<br><br>print(train_size)<br>print(val_size)<br>print(test_size)<br><br># since our data is already shuffled we can use take and skip<br><br>train = data.take(train_size)<br>val = data.skip(train_size).take(val_size)<br>test = data.skip(train_size+val_size).take(test_size)</pre><p>“take” defines how much data we are going to take in that particular partition</p><h4>Deep Learning Model</h4><pre>from tensorflow.keras.models import Sequential<br>from tensorflow.keras.layers import Conv2D, MaxPooling2D, Dense, Flatten<br><br>model = Sequential() # create a model<br><br># conv with 16 filters and filter is 3x3 size, a stride of 1<br>model.add(Conv2D(16, (3,3), 1, activation = &#39;relu&#39;, input_shape = (256,256,3)))<br>model.add(MaxPooling2D())<br><br>model.add(Conv2D(32, (3,3), 1, activation = &#39;relu&#39;))<br>model.add(MaxPooling2D())<br><br>model.add(Conv2D(16, (3,3), 1, activation = &#39;relu&#39;))<br>model.add(MaxPooling2D())<br><br>model.add(Flatten())<br><br># in keras fully connected layers are called Dense Layers<br>model.add(Dense(256,activation = &#39;relu&#39;))<br>model.add(Dense(1, activation = &#39;sigmoid&#39;)) # for a single output representating 0 or 1</pre><p>When you build your own network, you form an architecture. An architecture is a bunch of layers or hidden layers which form a deep neural network. Here, we add layers sequentially.</p><p>The first layer needs to have the input. The convolution has 16 filters. Basically it scans the image and condense or extract the relevant information inside the image to make an output classification. Filter is 3 pixels by 3 pixels in size and we have a stride of 1 which means it moves 1 pixel each time. ReLU activation converts negative numbers to 0 and preserves the positive values. This allows us to take non linear patterns.</p><p>MaxPooling layer takes the maximum value after the ReLU activation. When we apply a convolutional layer, the filters are going to be the last channel. We condense the rows and width, the number of filters will form the channel value. When we pass this to our Dense layer, we don’t want that channel value. We want to condense it down to a SINGLE value, by flattening it that’s what we are effectively doing.</p><p>If the output of the sigmoid function is less than 0.5 then customer is INTERESTED else not. This is out final output.</p><h4>More about Layers:</h4><p>There are two model building APIs available inside tensorflow: Sequential (for one data input and one data output and the model flows from top to bottom) and Functional(multiple inputs, outputs and connections).</p><ol><li>Convolutional Layer: A convolutional layer is the core building block of a convolutional neural network (CNN). It performs a mathematical operation called convolution on the input data, using learnable filters or kernels to extract important features from the input image. The result is a feature map that highlights relevant patterns and spatial information.</li><li>Max Pooling Layer: Divides the input into small non-overlapping regions and selects the maximum value from each region, reducing the size of the feature map and making the network more computationally efficient.</li><li>Dense Layer (Fully Connected Layer): A dense layer is a traditional neural network layer where every neuron is connected to every neuron in the previous layer. It’s the final layer in many neural networks, responsible for transforming the extracted features into predictions or classifications by learning appropriate weights and biases.</li><li>Flatten Layer: The flatten layer is used to convert multi-dimensional data (such as feature maps from convolutional layers) into a one-dimensional vector. It takes the output from the previous layer and reshapes it, creating a continuous sequence of values that can be fed into a dense layer for further processing.</li></ol><p>Activation functions are an essential component of artificial neural networks, responsible for introducing non-linearity into the model.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/726/1*-XQFm8PIrtRuprTqay9wbw.png" /><figcaption><a href="https://towardsdatascience.com/activation-functions-neural-networks-1cbd9f8d91d6">https://towardsdatascience.com/activation-functions-neural-networks-1cbd9f8d91d6</a></figcaption></figure><p>To save your model at a particular checkpoint use</p><pre>logdir = (&#39;logs&#39;) # create logs directory<br>tensorboard_callback = tf.keras.callbacks.TensorBoard(log_dir = logdir)</pre><p>This will log your model as it trains. Hence, if you want to come back and see how your model performed, change the learning etc you can find that information here.</p><h4>Training</h4><pre>hist = model.fit(train, epochs = 40, validation_data = val, callbacks = [tensorboard_callback])</pre><p>Epochs is how long we are going to train for … one epoch is one run over our entire training data.</p><h4>Plotting Performance</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/547/1*7c-KRHiQPkhW1a9wbfzkBA.png" /></figure><pre>fig = plt.figure()<br>plt.plot(hist.history[&#39;loss&#39;], color = &#39;teal&#39;, label = &#39;loss&#39;)<br>plt.plot(hist.history[&#39;val_loss&#39;], color = &#39;orange&#39;, label = &#39;val_loss&#39;)<br>fig.suptitle(&#39;Loss&#39;, fontsize = 20)<br>plt.legend(loc = &#39;upper left&#39;)<br>plt.show()</pre><p>Our loss is decreasing steadily. If you see your loss going down and your validation loss going up it means your model has overfit that is, it has memorized the data. In that case, you should apply regularlization techniques. If your loss doesn’t decrease over time then consider adding more data or consider a different/larger/more sophisticated neural network because it means that the existing neural network model is not able to learn for that particular training data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/547/1*0Z0GI4Gd0nb-aJz_9XNU2g.png" /></figure><pre>fig = plt.figure()<br>plt.plot(hist.history[&#39;accuracy&#39;], color = &#39;teal&#39;, label = &#39;accuracy&#39;)<br>plt.plot(hist.history[&#39;val_accuracy&#39;], color = &#39;orange&#39;, label = &#39;val_accuracy&#39;)<br>fig.suptitle(&#39;Accuracy&#39;, fontsize = 20)<br>plt.legend(loc = &#39;upper left&#39;)<br>plt.show()</pre><p>Accuracy steadily increased over time.</p><h4>Evaluate Performance</h4><p>In order to evaluate our model we need a few key metrics</p><pre>from tensorflow.keras.metrics import Precision, Recall, BinaryAccuracy<br><br>precision = Precision()<br>recall = Recall()<br>accuracy = BinaryAccuracy()<br><br>for batch in test.as_numpy_iterator():<br>  X, y = batch # X - images , y - true labels<br>  yhat = model.predict(X)<br>  precision.update_state(y, yhat)<br>  recall.update_state(y, yhat)<br>  accuracy.update_state(y, yhat)</pre><ol><li>Precision: Precision is a performance metric used in binary classification tasks. It measures the accuracy of positive predictions made by a model, i.e., the ability of the model to correctly identify true positive instances (correctly predicted positive cases) out of all instances it predicted as positive. A high precision indicates that the model is making fewer false positive errors, which is crucial when the cost of false positives is significant.</li><li>Recall: Recall, also known as sensitivity or true positive rate, is another metric used in binary classification. It measures the ability of the model to correctly identify all positive instances in the dataset. It calculates the proportion of true positive instances (correctly predicted positive cases) out of all actual positive instances. A high recall indicates that the model is effective at capturing positive cases, which is essential when missing positive cases is costly.</li><li>Accuracy: Accuracy is a common evaluation metric for classification tasks, both binary and multi-class. It represents the overall correctness of the model’s predictions and measures the proportion of correct predictions (both true positives and true negatives) out of all the instances. While accuracy is a useful metric, it may not be suitable for imbalanced datasets, where the class distribution is significantly skewed.</li></ol><h4>Testing</h4><p>Loading our image</p><pre>img = cv2.imread(&#39;test1.png&#39;)<br>plt.imshow(cv2.cvtColor(img, cv2.COLOR_BGR2RGB))<br>plt.show()<br><br># NN accepts images of the size 256x256<br>resize = tf.image.resize(img, (256,256))<br># plt.imshow(cv2.cvtColor(img, cv2.COLOR_BGR2RGB))<br>plt.imshow(resize.numpy().astype(int))<br>plt.show()</pre><pre># NN accepts a batch of images and not a single image, hence<br>np.expand_dims(resize, 0).shape</pre><p>Our neural network expects us to pass a batch of images and not a single image. Hence, we need to encapsulate it inside another set of parenthesis or put inside of another list or arrays.</p><pre>yhat = model.predict(np.expand_dims(resize/255,0))</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/552/1*WvSfG0W6sGfK5VXM3jA9BA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ffR8IEAopkcs93i2QoIOkg.png" /></figure><p>Since yhat = 0.99 which is greater than 0.5 — Customer is Not Interested</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/555/1*MnXFPKSwOslXcUw-G7lRQQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Bl7jLhfPdQOAsecQFJyP-g.png" /></figure><p>Customer Interested</p><h4>Using YOLOv8 for Image Classification</h4><p>Yolov8 is one of the best models to use for image classification, object detection and instance segmentation in terms of convenience and easy of use. It is very straightforward to use the model. The only thing to need to keep in mind is keeping your dataset in the required format (shown below)</p><pre>root/<br>|-- class1/<br>|   |-- img1.jpg<br>|   |-- img2.jpg<br>|   |-- ...<br>|<br>|-- class2/<br>|   |-- img1.jpg<br>|   |-- img2.jpg<br>|   |-- ...<br>|<br>|-- class3/<br>|   |-- img1.jpg<br>|   |-- img2.jpg<br>|   |-- ...<br>|<br>|-- ...</pre><p>Here, class 1,2 and 3 are the classes you want to classify your data into.</p><p>Then, you need to install Ultralytics and import YOLO</p><p><a href="https://docs.ultralytics.com/">https://docs.ultralytics.com/</a></p><pre>!pip install ultralytics<br>from ultralytics import YOLO</pre><p>Now you need to download and save a pretrained yolov8 classification model in order for transfer learning in the same directory as your notebook in your work environment.</p><pre>model_8s = YOLO(&#39;yolov8s-cls.pt&#39;)</pre><p>Train the model</p><pre>model_8s.train(data = &#39;/content/drive/MyDrive/Projects/Emotion Detection/data/&#39;, epochs = 10)</pre><p>Evaluate the model</p><pre># Validate the model<br>metrics = model_8s.val()  # no arguments needed, dataset and settings remembered<br>metrics.top1   # top1 accuracy<br>metrics.top5   # top5 accuracy</pre><p>Predict on test images</p><pre>source = &#39;/content/drive/MyDrive/Projects/Emotion Detection/test_data&#39;<br># Predict with the model<br>model_8s.predict(source, save=True, imgsz=320, conf=0.5)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/620/1*2rY-YzqcNeL-feRRW2gjxw.jpeg" /><figcaption>Model classifies poker face as uninterested 😂</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/265/1*G8Fq65XQflLkluFA8XWcSA.jpeg" /><figcaption>Shaq is clearly not interested in whatever is happening</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*G80HWrllULP6Tj9BjjGITg.jpeg" /><figcaption>This man is completely in the moment!</figcaption></figure><p>We see that the model is giving some false positives. Getting real world data of customers watching content could potentially solve this problem. The performance of the model can be made a lot better by getting quality data.</p><p>Github: <a href="https://github.com/shrunalisalian/Decoding-Viewer-Engagement-Unveiling-the-Emotions-Behind-Content-Consumption/tree/main">https://github.com/shrunalisalian/Decoding-Viewer-Engagement-Unveiling-the-Emotions-Behind-Content-Consumption/tree/main</a></p><p>Anyway, that’s all for this project :) Feel free to let me know if you have any feedback!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b34c4131fb23" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Streaming Wars with Sentiment Analysis using Roberta model: Apple TV+]]></title>
            <link>https://medium.com/@shrunalisalian97/streaming-wars-apple-tv-7b86698e40de?source=rss-97aa7b72566b------2</link>
            <guid isPermaLink="false">https://medium.com/p/7b86698e40de</guid>
            <dc:creator><![CDATA[Shrunali Suresh Salian]]></dc:creator>
            <pubDate>Wed, 07 Jun 2023 02:55:51 GMT</pubDate>
            <atom:updated>2023-06-07T03:29:15.379Z</atom:updated>
            <content:encoded><![CDATA[<p>Apple TV+ is a subscription-based streaming service offered by Apple Inc. It was launched on November 1, 2019, and aims to provide original, high-quality content across various genres. Apple TV+ differentiates itself by focusing solely on original programming rather than offering a vast library of licensed content.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gcOY-ZkHt2WbNi5wPEhDBw.jpeg" /></figure><p>The article is based on the Kaggle dataset available for AppleTV + . It’s important to note that the analysis and conclusions based on the dataset for Apple TV+ may not reflect the current trends and offerings of Apple TV+. The dataset provides insights based on a specific time period and may not capture the most up-to-date information or changes in the streaming platform.</p><h4>What would you rather watch? Movies or TV shows?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6DSWt_JlJpvg7jva9sbRlw.png" /><figcaption>Apple TV is the only online streaming platform that has a greater number of tv shows than movies.</figcaption></figure><p>Apple TV+ is distinguished among online streaming platforms as it prioritizes original TV shows over movies. While other streaming services often have a larger collection of movies, Apple TV+ focuses on delivering a diverse range of high-quality TV series. This strategic approach allows Apple TV+ to showcase its commitment to storytelling and offer compelling narratives through episodic content.</p><pre>count_data = showtime[&#39;type&#39;].value_counts()<br><br># Create a horizontal bar chart<br>fig = go.Figure(data=go.Bar(<br>    y=count_data.index,<br>    x=count_data.values,<br>    orientation=&#39;h&#39;,<br>    marker=dict(color=[&#39;#666666&#39;,&#39;#0088cc&#39;])<br>))<br><br># Set title and axis labels<br>fig.update_layout(<br>    title=&#39;Content on Apple TV+ &#39;,<br>    xaxis_title=&#39;Count&#39;,<br>    yaxis_title=&#39;Type of Content&#39;, title_x = 0.5<br>)<br>fig.show()</pre><h4>Global Apple TV+ market share</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HoBGGiPEaLbnebxONFFwvA.png" /><figcaption>US holds Apple’s largest market share</figcaption></figure><p>Apple TV+ enjoys a significant market share in the United States, with 80% of its user base located in the country. Following the US, the United Kingdom holds the second-largest market share at 10%, while Canada accounts for approximately 6% of Apple TV+ subscribers.</p><pre>top_countries = top_countries[:5]<br>fig = px.pie(top_countries, values=&#39;content_produced&#39;, names=&#39;production_country&#39;,<br>             title=&#39;Contribution of Content Produced by Top 5 Countries on Apple TV+&#39;)<br><br># Change the color palette<br>fig.update_traces(marker=dict(colors=[&#39;#000000&#39;,&#39;#666666&#39;, &#39;#979797&#39;,&#39;#eeeeee&#39;,&#39;#0088cc&#39;]))<br><br># Set the text position and information to be displayed<br>fig.update_traces(textposition=&#39;inside&#39;, textinfo=&#39;percent+label&#39;)<br><br>fig.show()</pre><h4>Apple TV+’s Content Distribution by Country</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a7mKLOOwlA7YnwKdAH78ng.png" /></figure><p>Italian (IT), Chinese (CN), and Austrian (AT) audiences show a strong preference for Apple TV+ movies, with a 100% viewership rate. On the other hand, audiences in the United States (US), United Kingdom (GB), and Canada (CA) are more inclined towards watching Apple TV+ shows.</p><p>This data suggests that different regions have varying preferences when it comes to content consumption on Apple TV+. Italian, Chinese, and Austrian audiences seem to gravitate towards Apple’s movie offerings, indicating a particular interest in the cinematic experience provided by the platform. Conversely, audiences in the US, UK, and Canada show a greater affinity for Apple TV+ original shows, showcasing a preference for serialized storytelling and episodic content.</p><pre>fig = go.Figure()<br>fig.add_trace(go.Bar(<br>    y=data_ratio.country_code,<br>    x=data_ratio[&#39;MOVIE&#39;],<br>    name=&#39;MOVIE&#39;,<br>    orientation=&#39;h&#39;,<br>    marker=dict(color=&#39;#000000&#39;),<br>    text=(data_ratio[&#39;MOVIE&#39;] * 100).astype(str) + &#39;%&#39;,  # Add text as percentages<br>    textposition=&#39;inside&#39;,  # Set text position inside the bars<br>    textfont=dict(color=&#39;white&#39;)  # Set text color<br>))<br><br>fig.add_trace(go.Bar(<br>    y=data_ratio.country_code,<br>    x=data_ratio[&#39;SHOW&#39;],<br>    name=&#39;SHOW&#39;,<br>    orientation=&#39;h&#39;,<br>    marker=dict(color=&#39;#0088cc&#39;),<br>    text=(data_ratio[&#39;SHOW&#39;] * 100).astype(str) + &#39;%&#39;,  # Add text as percentages<br>    textposition=&#39;inside&#39;,  # Set text position inside the bars<br>    textfont=dict(color=&#39;white&#39;)  # Set text color<br>))<br><br># Set the layout<br>fig.update_layout(<br>    title=&#39;Content Distribution of Apple TV+ by Country&#39;,<br>    barmode=&#39;stack&#39;,<br>    yaxis_title=&#39;Top 10 Countries&#39;,<br>    xaxis=dict(showticklabels=False), title_x = 0.5 # Hide the x-axis tick labels<br>)<br><br>fig.show()</pre><h4>Well looks like Apple is into some dramatically serious stuff 🤓</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HZu2mEuhXVggLdUo5P7Yzg.png" /><figcaption>Drama dominates Apple’s content on it’s streaming platform</figcaption></figure><p>Drama takes the lead as the dominant genre in Apple TV+’s content library, showcasing a strong emphasis on compelling storytelling and character-driven narratives. Following closely behind are documentaries, offering informative and thought-provoking content to engage viewers. Animation, known for its creativity and visual appeal, holds a significant presence, catering to audiences of all ages. Comedy, with its lighthearted and humorous nature, adds an element of entertainment and levity to Apple TV+’s offerings.</p><pre>genre_distribution = pd.DataFrame(showtime.groupby(&#39;primary_genre&#39;)[&#39;type&#39;].value_counts())<br>genre_distribution = genre_distribution.unstack().reset_index().fillna(0).drop(0)<br>genre_distribution[&#39;SUM&#39;] = genre_distribution.sum(axis = 1)<br>genre_distribution.columns = [&#39;primary_genre&#39;, &#39;MOVIE&#39;, &#39;SHOW&#39;, &#39;total&#39;]<br>genre_distribution = genre_distribution.sort_values(&#39;total&#39;, ascending = False)<br>fig1 = go.Figure()<br>fig1.add_trace(go.Bar(<br>    x=genre_distribution[&#39;primary_genre&#39;],<br>    y=genre_distribution[&#39;MOVIE&#39;],<br>    name=&#39;MOVIE&#39;,<br>    marker=dict(color=&#39;#000000&#39;),<br>))<br><br>fig1.add_trace(go.Bar(<br>    x=genre_distribution[&#39;primary_genre&#39;],<br>    y=genre_distribution[&#39;SHOW&#39;],<br>    name=&#39;SHOW&#39;,<br>    marker=dict(color=&#39;#0088cc&#39;),<br>))<br><br>fig1.update_layout(<br>    title=&#39;Content Distribution by Genre on Apple TV+&#39;,<br>    xaxis_title=&#39;Genre&#39;,<br>    yaxis_title=&#39;Content on Apple TV+&#39;,<br>    barmode=&#39;stack&#39;<br>)<br>fig1.show()</pre><h4>Another platform for mature audiences</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SfFUd_tshby-2LLOYz24lg.png" /><figcaption>Apple has a greater number of shows for mature audiences, second followed by R-rated content in movies.</figcaption></figure><p>Apple TV+ takes a distinct approach by focusing on producing a significant number of shows tailored for mature audiences. These shows are likely to explore complex themes, mature storylines, and target a more adult demographic. In addition to the mature-oriented shows, Apple TV+ also features a substantial collection of R-rated movies, which further caters to viewers seeking content with more mature and potentially intense or provocative elements.</p><pre>rating_distribution = pd.DataFrame(showtime.groupby(&#39;age_certification&#39;)[&#39;type&#39;].value_counts())<br># rating_distribution = genre_distribution.unstack().reset_index().fillna(0).drop(0)<br>rating_distribution = rating_distribution.unstack().reset_index().fillna(0)<br>rating_distribution[&#39;SUM&#39;] = rating_distribution.sum(axis = 1)<br>rating_distribution.columns = [&#39;age_certification&#39;,&#39;MOVIE&#39;,&#39;SHOW&#39;,&#39;Total&#39;]<br>rating_distribution = rating_distribution.sort_values(&#39;Total&#39;, ascending = False)<br>rating_distribution = rating_distribution[rating_distribution[&#39;age_certification&#39;]!=&#39;0&#39;]<br>fig2 = go.Figure()<br><br>fig2.add_trace(go.Bar(<br>    x=rating_distribution[&#39;age_certification&#39;],<br>    y=rating_distribution[&#39;MOVIE&#39;],<br>    name=&#39;MOVIE&#39;,<br>    marker=dict(color=&#39;#000000&#39;),<br><br>))<br><br>fig2.add_trace(go.Bar(<br>    x=rating_distribution[&#39;age_certification&#39;],<br>    y=rating_distribution[&#39;SHOW&#39;],<br>    name=&#39;SHOW&#39;,<br>    marker=dict(color=&#39;#0088cc&#39;),<br><br>))<br><br>fig2.update_layout(<br>    title=&#39;Content Distribution by Age Rating Certification on Apple TV+&#39;,<br>    xaxis_title=&#39;Genre&#39;,<br>    yaxis_title=&#39;Content on Apple TV+&#39;,<br>    barmode=&#39;stack&#39;, legend_title = &#39;Type of Content&#39;, title_x = 0.5<br>)<br><br>fig2.show()</pre><h4>Who is Apple TV+ targeting in your country?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*T6Fw-51NLuU7ZwGjGea6Tg.png" /><figcaption>Apple’s audience targeting is more country based.</figcaption></figure><p>Apple TV+ adopts a localized approach to audience targeting, tailoring its content offerings based on specific countries. In the United States and Great Britain, Apple’s primary target audience is adults. This suggests that Apple TV+ curates shows and movies that cater to the preferences and interests of adult viewers in these regions, providing content that aligns with their tastes and demographics.</p><p>On the other hand, in Canada and Ireland, Apple’s target audience shifts towards children. This indicates that Apple TV+ focuses on delivering content that appeals to younger viewers in these countries, potentially offering a range of engaging and age-appropriate programming for kids.</p><pre>total_count = demographic_data[&#39;count&#39;].sum()<br>demographic_data[&#39;percentage&#39;] = (demographic_data[&#39;count&#39;] / total_count) * 100<br><br>fig = px.treemap(demographic_data, path=[&#39;production_country&#39;, &#39;target_ages&#39;], values=&#39;percentage&#39;,<br>                 color=&#39;target_ages&#39;, color_discrete_sequence=[&#39;#000000&#39;,&#39;#666666&#39;, &#39;#979797&#39;,&#39;#eeeeee&#39;,&#39;#0088cc&#39;])<br><br>fig.update_layout(title= &quot;Apple TV+&#39;s Country-Level Target Audience&quot;,<br>                  margin=dict(l=20, r=20, t=40, b=20), title_x = 0.5)  # Adjust the margins as needed<br><br>fig.show()</pre><h4>Drama is the name of the game for Americans🤟🏻</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o4dnpwxQsbXIcl4hVOiJzg.png" /></figure><p>In the United States, Apple TV+ places a strong emphasis on dramatic content, recognizing the audience’s preference for compelling narratives and thought-provoking storytelling.</p><p>In Great Britain, Apple TV+ prioritizes documentaries. Documentaries offer a unique perspective on real-life subjects, allowing viewers to explore and understand various topics in depth. In Canada, Apple TV+ also focuses on animation, indicating a similar interest in visually engaging content.</p><h4>Relationship between IMDb and TMDb scores</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jSVvcUVZOiY4FrjM9vdJsw.png" /><figcaption>Apple’s the first to break the mold, Apple movies are rated almost similar to its tv shows.</figcaption></figure><p>Apple TV+ has distinguished itself by delivering a unique and innovative approach to content creation. Unlike traditional streaming platforms, Apple TV+ has achieved a balance between movies and TV shows in terms of ratings. This indicates that Apple is committed to producing high-quality and well-received content across both formats.</p><h4>What’s the sentiment of content on Apple TV?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FbxN1tP5h9TrYHscFZx3Ug.png" /><figcaption>Using Roberta model by Hugging Face to categorize movies as Positive, Neutral and Negative based on the content description</figcaption></figure><blockquote><a href="https://huggingface.co/docs/transformers/model_doc/roberta">Hugging Face’s Roberta</a> model helps in gauging the sentiment of the content based on the description provided. Roberta excels in understanding context and language patterns and is better at sarcastic sentences, while VADER focuses on sentiment quantification.</blockquote><p>The chart provides a quality assessment for each of the movies using the Roberta model. The model helps us in understanding what type of content is produced by Apple TV+.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sp0XLqmuGLKzD1w6jATgZQ.png" /><figcaption>40% of content on Apple TV+ is neutral, 15% is negative and 44% is positive</figcaption></figure><p>Apple is the only online streaming service that has the highest positive sentiment content not only on it’s platform but across all platforms.</p><p>The emphasis on positive sentiment content reflects Apple’s dedication to providing uplifting, inspiring, and heartwarming storytelling. This approach not only appeals to a wide range of viewers but also contributes to a more enjoyable and optimistic viewing experience.</p><p>By prioritizing positive sentiment content, Apple has created a niche for itself in the streaming landscape, attracting viewers who seek out feel-good stories and uplifting narratives.</p><pre>showtime[&#39;sentiment&#39;] = showtime.apply(lambda row: &#39;Negative&#39; if row[&#39;roberta_neg&#39;] &gt; 0.5 else (&#39;Neutral&#39; if row[&#39;roberta_neu&#39;] &gt; 0.5 else &#39;Positive&#39;), axis=1)<br>sentiment_counts = showtime[&#39;sentiment&#39;].value_counts()<br><br># Create the donut chart trace<br>fig4 = go.Figure(data=[go.Pie(<br>    labels=sentiment_counts.index,<br>    values=sentiment_counts.values,<br>    hole=0.5,  # Set the hole parameter to create a donut chart<br>    marker=dict(colors=[&#39;#000000&#39;,&#39;#666666&#39;, &#39;#979797&#39;,&#39;#eeeeee&#39;,&#39;#0088cc&#39;]),  # Set custom colors for the slices<br>    textinfo=&#39;label+percent&#39;,  # Display labels and percentages<br>    textposition=&#39;inside&#39;,  # Set the position of the labels inside the slice<br>)])<br><br># Set the layout<br>fig4.update_layout(<br>    title=&#39;Sentiment Distribution of Content on Apple TV+&#39;,<br>    showlegend=True, title_x = 0.5, <br>    # Add annotations in the center of the donut pies.<br>    annotations=[dict(text=&#39;Apple TV+&#39;, x=0.50, y=0.5, font_size=15, showarrow=False)]<br>)<br>fig4.show()</pre><h3>Relationship between IMDb and TMDb scores of content on Apple TV+ categorized according to the content sentiment</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lHF9qT-XdFmWOdCU4lEWFA.png" /><figcaption>There is no relationship between the sentiment of the content with the IMDb &amp; TMDb scores</figcaption></figure><p>The lack of a relationship between content sentiment and IMDb/TMDb scores suggests that the audience’s perception of a piece of content goes beyond its sentiment alone. Numerous factors, such as the quality of acting, storytelling, production value, and personal preferences, can influence viewers’ ratings and reviews.</p><h3>What type of content are you watching?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RUJD4yMNKO_6PaSO28XGxQ.png" /><figcaption>Most of the content on Apple is either positive or neutral.</figcaption></figure><p>On Apple TV+, the majority of content is categorized as either positive or neutral, indicating a focus on delivering uplifting and balanced storytelling. Drama emerges as the genre with the highest number of neutral sentiment content, followed by negative and positive sentiment content.</p><pre>genre_sentiment = showtime.groupby([&#39;primary_genre&#39;, &#39;sentiment&#39;]).size().reset_index(name=&#39;count&#39;)<br>genre_sentiment = genre_sentiment[genre_sentiment[&#39;primary_genre&#39;]!= &#39;No Data&#39;]<br>genre_sentiment = genre_sentiment.sort_values(&#39;count&#39;, ascending = False)<br>colors = [&#39;#000000&#39;,&#39;#666666&#39;, &#39;#979797&#39;,&#39;#eeeeee&#39;,&#39;#0088cc&#39;]<br>fig = px.sunburst(genre_sentiment, path=[&#39;primary_genre&#39;, &#39;sentiment&#39;], values=&#39;count&#39;,<br>                  color_discrete_sequence=colors)<br><br>fig.update_layout(title=&#39;Genre vs Sentiments on Apple TV+&#39;, title_x = 0.5)<br><br>fig.show()</pre><h3>Keep your ratings and sentiments in check…</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zGWK6DBwgpHJNt8GJVrpXg.png" /><figcaption>Apple’s largest segment on its streaming platform caters to the TV-MA audience</figcaption></figure><p>The TV-MA rating indicates that the content is intended for mature audiences and may contain explicit language, violence, or adult themes. Apple’s approach to producing content for this audience involves presenting a diverse range of narratives and emotions.</p><h3>Words mostly likely to make it to the title on Apple TV+</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fPv7RwGQSxT3LQMRW_Poow.png" /><figcaption>Word cloud of content titles on Apple TV+</figcaption></figure><p>The most common words in the word cloud for Apple TV+ include “Charlie Brown,” “Oprah,” “Christmas,” “Rock,” “Snoopy,” “Presents,” and “Little.” These words suggest that Apple TV+ features content that encompasses various themes and genres.</p><pre>showtime[&#39;title&#39;] = showtime[&#39;title&#39;].astype(str)<br>title_corpus = &#39; &#39;.join(showtime[&#39;title&#39;])<br>from wordcloud import WordCloud, STOPWORDS, ImageColorGenerator<br>stopwords = set(STOPWORDS)<br><br># Define a function to specify the text color<br>def paramount_color(word, font_size, position, orientation, random_state=None, **kwargs):<br>    return &quot;#ffffff&quot;<br><br>custom_mask = np.array(Image.open(&#39;apple.jpg&#39;)) <br>wc = WordCloud(<br>               stopwords = stopwords,<br>               mask = custom_mask,height = 2000, width = 4000, color_func = paramount_color)<br>#background_color = &#39;white&#39;,<br>wc.generate(title_corpus)<br><br>plt.figure(figsize=(16,8))<br>plt.imshow(wc, interpolation = &#39;bilinear&#39;)<br>plt.axis(&#39;off&#39;)<br>plt.show()</pre><h4>Runtime Distribution of Content on Apple TV+</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4D00FIyiKU_u0mfP-Vvx4A.png" /><figcaption>The average runtime of content on Apple TV+ is shorter compared to any other online streaming platform</figcaption></figure><p>The average runtime of content on Apple TV+ is shorter, with most content having a duration of less than 60 minutes. This could be attributed to the fact that Apple TV+ focuses more on TV shows rather than movies, which is evident from the histogram distribution.</p><h4>Who is your Favorite Actor on Apple TV+?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wMqL3KTZljVTkSpX-LmIQQ.png" /><figcaption>Word cloud of actors on Apple TV+</figcaption></figure><p>In conclusion, Apple TV+ stands out among online streaming platforms with its unique offerings and approach. With a greater emphasis on TV shows rather than movies, Apple TV+ has carved its own niche in the streaming landscape. It targets a diverse range of audiences, with a particular focus on adult viewers in the US and GB, and kids in CA and IE.</p><p>Apple TV+ boasts a wide variety of content genres, with drama, documentaries, animation, and comedy being the prominent categories. It is known for its high-quality, top-notch programming and has gained recognition for its positive and neutral content, which sets it apart from other platforms.</p><p>The streaming service’s content distribution is well-tailored to different regions, with specific genres and target audiences in mind. While drama and documentaries dominate in the US, GB showcases a preference for documentaries and animation. This localized approach reflects Apple TV+’s commitment to providing content that resonates with specific markets.</p><p>Apple TV+ excels in offering shorter-form content, with a focus on TV shows and episodes that have an average runtime of less than 60 minutes. This aligns with the platform’s strategy of providing easily consumable, episodic storytelling that appeals to viewers seeking shorter, more flexible viewing experiences.</p><p>The project code is available on my Github: <a href="https://github.com/shrunalisalian/Streaming-Wars">https://github.com/shrunalisalian/Streaming-Wars</a></p><p>Apple TV+ Dataset on Kaggle: <a href="https://www.kaggle.com/datasets/dgoenrique/apple-tv-movies-and-tv-shows">https://www.kaggle.com/datasets/dgoenrique/apple-tv-movies-and-tv-shows</a></p><p>In case you enjoyed reading this article, feel free to check out articles on <a href="https://medium.com/@shrunalisalian97/streaming-wars-3aad80f5a305">Amazon Prime Video</a>, <a href="https://medium.com/@shrunalisalian97/streaming-wars-netflix-c314fa95cc2e">Netflix</a>, <a href="https://medium.com/@shrunalisalian97/streaming-wars-hbo-max-9109a32bac1">HBO Max</a>, <a href="https://medium.com/@shrunalisalian97/streaming-wars-disney-516662799258">Disney</a>+ and <a href="https://medium.com/@shrunalisalian97/streaming-wars-paramount-27846654f387">Paramount+</a></p><p>Feel free to let me know if you have any suggestions. Thank You for reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7b86698e40de" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Streaming Wars with Sentiment Analysis using Roberta model: Paramount+]]></title>
            <link>https://medium.com/@shrunalisalian97/streaming-wars-paramount-27846654f387?source=rss-97aa7b72566b------2</link>
            <guid isPermaLink="false">https://medium.com/p/27846654f387</guid>
            <dc:creator><![CDATA[Shrunali Suresh Salian]]></dc:creator>
            <pubDate>Tue, 06 Jun 2023 22:27:51 GMT</pubDate>
            <atom:updated>2023-08-28T19:20:53.884Z</atom:updated>
            <content:encoded><![CDATA[<p>Paramount+ is a prominent streaming platform that offers a diverse range of content to its subscribers. Launched by ViacomCBS, Paramount+ provides access to a vast library of movies, TV shows, and original programming from various networks and studios under the ViacomCBS umbrella.</p><p>One of the standout features of Paramount+ is its extensive collection of beloved franchises and iconic properties. Subscribers can enjoy a wide range of content from popular networks such as CBS, MTV, Nickelodeon, Comedy Central, and BET, among others. This includes a rich selection of classic TV shows, current series, and exclusive content that spans multiple genres and interests.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Uh5rxXs5KcQjJdmaR1yWBQ.png" /></figure><p>The article is based on the Kaggle dataset available for Paramount+ . It’s important to note that the analysis and conclusions based on the dataset for Paramount+ may not reflect the current trends and offerings of Paramount+. The dataset provides insights based on a specific time period and may not capture the most up-to-date information or changes in the streaming platform.</p><h4>What do you like watching? Movies or TV Shows?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yoG8kKhSxZ4JWGnSlN35Mw.png" /><figcaption>For every four movies there is one tv show on Paramount+</figcaption></figure><p>This distribution strategy allows subscribers to enjoy a diverse mix of both feature-length films and episodic series, catering to different viewing preferences on Paramount+.</p><pre>count_data = showtime[&#39;type&#39;].value_counts()<br><br># Create a horizontal bar chart<br>fig = go.Figure(data=go.Bar(<br>    y=count_data.index,<br>    x=count_data.values,<br>    orientation=&#39;h&#39;,<br>    marker=dict(color=[&#39;#0c0c0c&#39;, &#39;#11518a&#39;])<br>))<br><br># Set title and axis labels<br>fig.update_layout(<br>    title=&#39;Content on Paramount+ &#39;,<br>    xaxis_title=&#39;Count&#39;,<br>    yaxis_title=&#39;Type of Content&#39;, title_x = 0.5<br>)<br>fig.show()</pre><h4>Who is dominating the Paramount+’s market share?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8RH5ECZDOZ1YK8pgxJCaEg.png" /><figcaption>US dominates 88% of Paramount+ ‘s market share</figcaption></figure><p>The dominance of the US market share is not unexpected, considering the origin of Paramount+ and its affiliation with ViacomCBS, a prominent American media conglomerate. However, the platform’s expansion and success in international markets, such as the UK and Canada, indicate its ability to captivate viewers beyond its home market.</p><pre>top_countries = pd.DataFrame(showtime[&#39;production_country&#39;].value_counts()[:10])<br>top_countries = top_countries.reset_index()<br>top_countries = top_countries[top_countries[&#39;index&#39;] != &#39;No Data&#39;]<br><br>top_countries = top_countries[:5]<br>fig = px.pie(top_countries, values=&#39;content_produced&#39;, names=&#39;production_country&#39;,<br>             title=&#39;Contribution of Content Produced by Top 5 Countries on Paramount+&#39;)<br><br># Change the color palette<br>fig.update_traces(marker=dict(colors=[&#39;#0c0c0c&#39;,&#39;#11518a&#39;, &#39;#226ca1&#39;,&#39;#9fa8ab&#39;,&#39;#f1f1f1&#39;]))<br><br># Set the text position and information to be displayed<br>fig.update_traces(textposition=&#39;inside&#39;, textinfo=&#39;percent+label&#39;)<br><br>fig.show()</pre><h4>Do we really like movies that much, or is it just a myth?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nuNO7xu7x4dlHv9Ak7Rlog.png" /></figure><p>When it comes to the distribution of movies and shows on Paramount+ across different countries, there are some notable trends. In Italy (IT), a significant majority of viewers, approximately 95%, prefer watching movies on the platform. This suggests a strong preference for cinematic experiences among Italian subscribers.</p><p>Similarly, in countries such as Germany (DE), South Africa (ZA), France (FR), Australia (AU), Spain (ES), the United Kingdom (GB), and the United States (US), more than 80% of viewers lean towards watching movies on Paramount+. This indicates a widespread interest in film content across these regions.</p><pre>fig = go.Figure()<br><br>fig.add_trace(go.Bar(<br>    y=data_ratio.country_code,<br>    x=data_ratio[&#39;MOVIE&#39;],<br>    name=&#39;MOVIE&#39;,<br>    orientation=&#39;h&#39;,<br>    marker=dict(color=&#39;#11518a&#39;),<br>    text=(data_ratio[&#39;MOVIE&#39;] * 100).astype(str) + &#39;%&#39;,  # Add text as percentages<br>    textposition=&#39;inside&#39;,  # Set text position inside the bars<br>    textfont=dict(color=&#39;white&#39;)  # Set text color<br>))<br><br>fig.add_trace(go.Bar(<br>    y=data_ratio.country_code,<br>    x=data_ratio[&#39;SHOW&#39;],<br>    name=&#39;SHOW&#39;,<br>    orientation=&#39;h&#39;,<br>    marker=dict(color=&#39;#9fa8ab&#39;),<br>    text=(data_ratio[&#39;SHOW&#39;] * 100).astype(str) + &#39;%&#39;,  # Add text as percentages<br>    textposition=&#39;inside&#39;,  # Set text position inside the bars<br>    textfont=dict(color=&#39;white&#39;)  # Set text color<br>))<br><br># Set the layout<br>fig.update_layout(<br>    title=&#39;Content Distribution by Country on Paramount+&#39;,<br>    barmode=&#39;stack&#39;,<br>    yaxis_title=&#39;Top 10 Countries&#39;,<br>    xaxis=dict(showticklabels=False), title_x = 0.5 # Hide the x-axis tick labels<br>)<br><br>fig.show()</pre><h4>What kind of a person are you: Drama or Comedy?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JcgjpAccfGYYD9CUYNgqZQ.png" /><figcaption>Most popular on Paramount+ : Drama, Comedy, and Documentary</figcaption></figure><p>When it comes to the most popular genres on Paramount+, there are three categories that stand out: Drama, Comedy, and Documentary. These genres have garnered significant attention and viewership on the platform, reflecting the preferences of Paramount+ subscribers.</p><pre>genre_distribution = pd.DataFrame(showtime.groupby(&#39;primary_genre&#39;)[&#39;type&#39;].value_counts())<br>genre_distribution = genre_distribution.unstack().reset_index().fillna(0).drop(0)<br>genre_distribution[&#39;SUM&#39;] = genre_distribution.sum(axis = 1)<br>genre_distribution.columns = [&#39;primary_genre&#39;, &#39;MOVIE&#39;, &#39;SHOW&#39;, &#39;total&#39;]<br>genre_distribution = genre_distribution.sort_values(&#39;total&#39;, ascending = False)<br>fig1 = go.Figure()<br>fig1.add_trace(go.Bar(<br>    x=genre_distribution[&#39;primary_genre&#39;],<br>    y=genre_distribution[&#39;MOVIE&#39;],<br>    name=&#39;MOVIE&#39;,<br>    marker=dict(color=&#39;#11518a&#39;),<br>))<br><br>fig1.add_trace(go.Bar(<br>    x=genre_distribution[&#39;primary_genre&#39;],<br>    y=genre_distribution[&#39;SHOW&#39;],<br>    name=&#39;SHOW&#39;,<br>    marker=dict(color=&#39;#9fa8ab&#39;),<br>))<br><br>fig1.update_layout(<br>    title=&#39;Content Distribution by Genre on Paramount+&#39;,<br>    xaxis_title=&#39;Genre&#39;,<br>    yaxis_title=&#39;Content on Paramount+&#39;,<br>    barmode=&#39;stack&#39;<br>)<br>fig1.show()</pre><h4>For mature audiences only …</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UcmyfgOnv5BG6ri54NyRMQ.png" /><figcaption>R rated movies are the highest on Paramount+</figcaption></figure><p>By offering a substantial selection of R-rated movies, Paramount+ caters to the preferences of adult viewers who enjoy edgier, more intense, and provocative storytelling. These movies often explore complex narratives, delve into gritty realism, or push boundaries in terms of content and subject matter.</p><pre>rating_distribution = pd.DataFrame(showtime.groupby(&#39;age_certification&#39;)[&#39;type&#39;].value_counts())<br># rating_distribution = genre_distribution.unstack().reset_index().fillna(0).drop(0)<br>rating_distribution = rating_distribution.unstack().reset_index().fillna(0)<br>rating_distribution[&#39;SUM&#39;] = rating_distribution.sum(axis = 1)<br>rating_distribution.columns = [&#39;age_certification&#39;,&#39;MOVIE&#39;,&#39;SHOW&#39;,&#39;Total&#39;]<br>rating_distribution = rating_distribution.sort_values(&#39;Total&#39;, ascending = False)<br>rating_distribution = rating_distribution[rating_distribution[&#39;age_certification&#39;]!=&#39;0&#39;]<br>fig2 = go.Figure()<br><br>fig2.add_trace(go.Bar(<br>    x=rating_distribution[&#39;age_certification&#39;],<br>    y=rating_distribution[&#39;MOVIE&#39;],<br>    name=&#39;MOVIE&#39;,<br>    marker=dict(color=&#39;#11518a&#39;),<br><br>))<br><br>fig2.add_trace(go.Bar(<br>    x=rating_distribution[&#39;age_certification&#39;],<br>    y=rating_distribution[&#39;SHOW&#39;],<br>    name=&#39;SHOW&#39;,<br>    marker=dict(color=&#39;#9fa8ab&#39;),<br><br>))<br><br>fig2.update_layout(<br>    title=&#39;Content Distribution by Age Rating Certification on Paramount+&#39;,<br>    xaxis_title=&#39;Genre&#39;,<br>    yaxis_title=&#39;Content on Paramount+&#39;,<br>    barmode=&#39;stack&#39;, legend_title = &#39;Type of Content&#39;, title_x = 0.5<br>)<br><br>fig2.show()</pre><h4>How old is the content that you are watching?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rhuYwYMAgn0ML9iD7ihrSA.png" /><figcaption>2018 was the year when the highest number of movies were added to the streaming platform</figcaption></figure><p>The year 2018 marked a significant milestone for Paramount+, as it witnessed the highest influx of movies being added to the streaming platform. During this period, Paramount+ made a notable effort to expand its content library by introducing a plethora of new films, providing viewers with a diverse range of options to enjoy.</p><pre>history = pd.DataFrame(showtime.groupby(&#39;release_year&#39;)[&#39;type&#39;].value_counts())<br>history = history.unstack().reset_index().fillna(0)<br># history[&#39;total&#39;] = history.sum(axis = 1)<br>history.columns = [&#39;release_year&#39;,&#39;MOVIE&#39;,&#39;SHOW&#39;]<br>history = history[(history[&#39;release_year&#39;] &gt;= 2000) &amp; (history[&#39;release_year&#39;] &lt;= 2021)]<br>fig3 = go.Figure()<br>fig3.add_trace(go.Scatter(<br>    x=history[&#39;release_year&#39;],<br>    y=history[&#39;MOVIE&#39;],<br>    mode=&#39;lines&#39;,<br>    name=&#39;MOVIE&#39;,<br>    fill=&#39;tozeroy&#39;,<br>    line=dict(color=&#39;#11518a&#39;)<br>))<br><br>fig3.add_trace(go.Scatter(<br>    x=history[&#39;release_year&#39;],<br>    y=history[&#39;SHOW&#39;],<br>    mode=&#39;lines&#39;,<br>    name=&#39;SHOW&#39;,<br>    fill=&#39;tozeroy&#39;,<br>    line=dict(color=&#39;#9fa8ab&#39;)<br>))<br><br># Set the layout<br>fig3.update_layout(<br>    title=&quot;How old is Paramount+&#39;s Content&quot;,<br>    xaxis_title=&#39;Release Year&#39;,<br>    yaxis_title=&#39;Content on Paramount+&#39;, showlegend = True, title_x =0.5<br>)<br>fig3.show()</pre><h4>Who is Paramount+ targeting in your country?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yUvXx8p4Fn2Y1zXcGEvEbA.png" /><figcaption>Paramount+’s content specifically targets adults in the US</figcaption></figure><p>Paramount+ has strategically positioned itself as a streaming platform that primarily caters to adult audiences in the United States. With a focus on delivering compelling and engaging content tailored to the preferences of this demographic, Paramount+ aims to captivate and entertain adult viewers seeking high-quality programming.</p><pre>total_count = demographic_data[&#39;count&#39;].sum()<br>demographic_data[&#39;percentage&#39;] = (demographic_data[&#39;count&#39;] / total_count) * 100<br><br>fig = px.treemap(demographic_data, path=[&#39;production_country&#39;, &#39;target_ages&#39;], values=&#39;percentage&#39;,<br>                 color=&#39;target_ages&#39;, color_discrete_sequence= [&#39;#0c0c0c&#39;,&#39;#11518a&#39;, &#39;#226ca1&#39;,&#39;#9fa8ab&#39;,&#39;#f1f1f1&#39;])<br><br>fig.update_layout(title= &quot;Disney+&#39;s Country-Level Target Audience&quot;,<br>                  margin=dict(l=20, r=20, t=40, b=20), title_x = 0.5)  # Adjust the margins as needed<br><br>fig.show()</pre><h4>What are you watching on Paramount+?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oGSzUSLb8vuWHZa37SQEmg.png" /><figcaption>It’s Drama vs Comedy in the US</figcaption></figure><p>The success of drama and comedy on Paramount+ highlights the platform’s ability to curate compelling and entertaining content that resonates with its audience. By consistently delivering high-quality programming in these genres, Paramount+ has established itself as a go-to destination for drama and comedy enthusiasts in the United States.</p><h4>We might watch more movies but we like shows better…</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GsTXUc1MtjzEk_aYarMOPg.png" /><figcaption>Relationship between IMDb and TMDb scores for content on Paramount+</figcaption></figure><p>Paramount+’s TV shows are rated higher than movies on both platforms IMDb and TMDb. This indicates that the platform’s TV series are resonating more with audiences and garnering positive feedback.</p><pre>fig = px.scatter(showtime, x=&#39;imdb_score&#39;, y=&#39;tmdb_score&#39;, color=&#39;type&#39;,<br>                 color_discrete_map={&#39;MOVIE&#39;: &#39;#11518a&#39;, &#39;SHOW&#39;: &#39;#9fa8ab&#39;},<br>                 hover_data=[&#39;title&#39;])<br><br>fig.update_layout(title=&#39;IMDb Score vs TMDB Score&#39;,<br>                  xaxis_title=&#39;IMDb Score&#39;,<br>                  yaxis_title=&#39;TMDB Score&#39;,<br>                  legend_title=&#39;Type&#39;, title_x =0.5)<br><br>fig.show()</pre><h4>Is it all a mind game 🤨 ?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g9GgO-aeZbnr9yIB3yFSPw.png" /><figcaption>Using Roberta model by Hugging Face to categorize movies as Positive, Neutral and Negative based on the content description</figcaption></figure><blockquote><a href="https://huggingface.co/docs/transformers/model_doc/roberta">Hugging Face’s Roberta</a> model helps in gauging the sentiment of the content based on the description provided. Roberta excels in understanding context and language patterns and is better at sarcastic sentences, while VADER focuses on sentiment quantification.</blockquote><p>The chart provides a quality assessment for each of the movies using the Roberta model. The model helps us in understanding what type of content is produced by Paramount+.</p><h4>What’s with all the fuss: Positive, Negative and Neutral</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4itjUhxK23jlJfrziGG_5Q.png" /><figcaption>48% of content on Paramount+ is neutral, 29% is negative and 22% is positive</figcaption></figure><p>This distribution of sentiment suggests a mixed range of emotions and tones in the content available on the platform. The significant portion of neutral content indicates a balance between positive and negative elements, where the overall sentiment may not strongly lean towards one direction.</p><p>The presence of negative content indicates that Paramount+ offers a range of stories that explore challenging themes, conflicts, and character arcs that may evoke emotional responses. These negative elements can contribute to the overall depth and complexity of the storytelling, providing viewers with thought-provoking and compelling narratives.</p><p>On the other hand, the positive content signifies moments of inspiration, joy, and uplifting storytelling that resonate with audiences. These elements can bring entertainment, optimism, and a sense of satisfaction to viewers, creating a well-rounded viewing experience.</p><pre>sentiment_counts = showtime[&#39;sentiment&#39;].value_counts()<br><br># Create the donut chart trace<br>fig4 = go.Figure(data=[go.Pie(<br>    labels=sentiment_counts.index,<br>    values=sentiment_counts.values,<br>    hole=0.5,  # Set the hole parameter to create a donut chart<br>    marker=dict(colors=[&#39;#0c0c0c&#39;,&#39;#11518a&#39;, &#39;#226ca1&#39;,&#39;#9fa8ab&#39;,&#39;#f1f1f1&#39;]),  # Set custom colors for the slices<br>    textinfo=&#39;label+percent&#39;,  # Display labels and percentages<br>    textposition=&#39;inside&#39;,  # Set the position of the labels inside the slice<br>)])<br><br># Set the layout<br>fig4.update_layout(<br>    title=&#39;Sentiment Distribution of Content on Paramount+&#39;,<br>    showlegend=True, title_x = 0.5, <br>    # Add annotations in the center of the donut pies.<br>    annotations=[dict(text=&#39;Paramount+&#39;, x=0.50, y=0.5, font_size=15, showarrow=False)]<br>)<br>fig4.show()</pre><h4>Relationship between IMDb and TMDb scores of content on Paramount+ categorized according to the content sentiment</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lH-MTPH5W1zFrjIY6ubNFA.png" /><figcaption>There is no relationship between the sentiment of the content with the IMDb &amp; TMDb scores</figcaption></figure><p>The lack of a relationship between content sentiment and IMDb/TMDb scores suggests that the audience’s perception of a piece of content goes beyond its sentiment alone. Numerous factors, such as the quality of acting, storytelling, production value, and personal preferences, can influence viewers’ ratings and reviews.</p><h4>What type of content are you watching?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6YYlfBbGZq2l00TogVaRmg.png" /></figure><p>Drama, comedy, documentaries, and thrillers collectively make up almost 60% of Paramount+’s content inventory. Among these genres, neutral sentiment tends to dominate, indicating a balanced portrayal of themes and storytelling elements that evoke a range of emotions.</p><p>However, it’s noteworthy that within the drama genre, there is a relatively higher proportion of content classified with negative sentiment. This suggests that Paramount+ offers a diverse range of dramatic narratives that delve into complex and challenging themes, potentially exploring conflicts, hardships, and intense character arcs. This darker or more intense content may resonate with viewers who appreciate thought-provoking and emotionally engaging storytelling.</p><p>On the other hand, comedy, documentaries, and other genres within the 60% inventory are more inclined towards neutral sentiment. This suggests a focus on content that appeals to a broader audience, offering entertainment, informative storytelling, and relatable narratives that may not lean heavily towards positive or negative emotions.</p><pre>genre_sentiment = showtime.groupby([&#39;primary_genre&#39;, &#39;sentiment&#39;]).size().reset_index(name=&#39;count&#39;)<br>genre_sentiment = genre_sentiment[genre_sentiment[&#39;primary_genre&#39;]!= &#39;No Data&#39;]<br>genre_sentiment = genre_sentiment.sort_values(&#39;count&#39;, ascending = False)<br>colors = [&#39;#0c0c0c&#39;,&#39;#11518a&#39;, &#39;#226ca1&#39;,&#39;#9fa8ab&#39;,&#39;#f1f1f1&#39;]<br>fig = px.sunburst(genre_sentiment, path=[&#39;primary_genre&#39;, &#39;sentiment&#39;], values=&#39;count&#39;,<br>                  color_discrete_sequence=colors)<br><br>fig.update_layout(title=&#39;Genre vs Sentiments on Paramount+&#39;, title_x = 0.5)<br><br>fig.show()</pre><h4>Keep your ratings and sentiments in check…</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qpq2Z7fm2QWi--Cx0hP-7w.png" /></figure><p>On Paramount+, R-rated content holds the highest proportion, and it is associated with the highest negative sentiment among the different content ratings. This indicates that Paramount+ offers a selection of content that may contain mature themes, explicit language, or graphic content, which can evoke more intense and potentially negative emotions in viewers.</p><h4>Words mostly likely to make it to the title on Paramount+</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*u4zXuJG__niKMGeNFv0umA.png" /><figcaption>Word cloud of content titles on Paramount+</figcaption></figure><p>When analyzing the titles of content on Paramount+, some of the most common words that emerge are “Love,” “Wild,” and “Story.” These words indicate that Paramount+ emphasizes content that revolves around themes of romance, adventure, and compelling narratives.</p><pre>showtime[&#39;title&#39;] = showtime[&#39;title&#39;].astype(str)<br>title_corpus = &#39; &#39;.join(showtime[&#39;title&#39;])<br>from wordcloud import WordCloud, STOPWORDS, ImageColorGenerator<br>stopwords = set(STOPWORDS)<br><br># Define a function to specify the text color<br>def paramount_color(word, font_size, position, orientation, random_state=None, **kwargs):<br>    return &quot;#f1f1f1&quot;<br><br>custom_mask = np.array(Image.open(&#39;paramount-plus.png&#39;)) <br>wc = WordCloud(<br>               stopwords = stopwords,<br>               mask = custom_mask,height = 2000, width = 4000, color_func = paramount_color)<br>#background_color = &#39;white&#39;,<br>wc.generate(title_corpus)<br><br>plt.figure(figsize=(16,8))<br>plt.imshow(wc, interpolation = &#39;bilinear&#39;)<br>plt.axis(&#39;off&#39;)<br>plt.show()</pre><p>Paramount+ stands as a competitive player in the streaming industry, offering a diverse range of content to cater to various audience preferences. With a focus on drama, comedy, documentaries, and thrillers, Paramount+ aims to provide engaging and entertaining experiences for its viewers.</p><p>The platform’s emphasis on adult-oriented content, particularly in the United States, showcases its intent to captivate a mature audience. However, Paramount+ also recognizes the importance of catering to younger viewers, with offerings that appeal to teens and older children.</p><p>The abundance of R-rated movies on Paramount+ highlights its commitment to providing edgier and more mature content, catering to viewers seeking a heightened level of intensity and storytelling.</p><p>The project code is available on my Github: <a href="https://github.com/shrunalisalian/Movie-Recommendation-System">https://github.com/shrunalisalian/Movie-Recommendation-System</a></p><p>Paramount+ Dataset on Kaggle: <a href="https://www.kaggle.com/datasets/dgoenrique/paramount-movies-and-tv-shows">https://www.kaggle.com/datasets/dgoenrique/paramount-movies-and-tv-shows</a></p><p>Feel free to let me know if you have any suggestions. Thank You for reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=27846654f387" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Streaming Wars with Sentiment Analysis using Roberta model: Disney+]]></title>
            <link>https://medium.com/@shrunalisalian97/streaming-wars-disney-516662799258?source=rss-97aa7b72566b------2</link>
            <guid isPermaLink="false">https://medium.com/p/516662799258</guid>
            <dc:creator><![CDATA[Shrunali Suresh Salian]]></dc:creator>
            <pubDate>Tue, 06 Jun 2023 21:14:09 GMT</pubDate>
            <atom:updated>2023-06-07T03:30:16.725Z</atom:updated>
            <content:encoded><![CDATA[<p>Disney+ is a popular streaming service that offers a vast collection of content from various franchises and properties owned by The Walt Disney Company. Launched in November 2019, Disney+ quickly gained traction and became a significant player in the streaming industry.</p><p>One of the key highlights of Disney+ is its extensive library of classic Disney films, including timeless animated classics like “The Lion King,” “Beauty and the Beast,” and “Cinderella.” The platform also features a wide range of content from other well-known brands and franchises, such as <strong>Marvel, Star Wars, Pixar, and National Geographic.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FPrdmTV4uZFvhVzrr7ceYg.png" /></figure><p>The article is based on the Kaggle dataset available for Disney + . It’s important to note that the analysis and conclusions based on the dataset for Disney+ may not reflect the current trends and offerings of Disney+. The dataset provides insights based on a specific time period and may not capture the most up-to-date information or changes in the streaming platform.</p><h4>Disney movies or shows? Hahaha…It’s a tough choice …</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vaGnSvjHYJjBtBlDYOHXBQ.png" /><figcaption>For approximately every 2 movies there’s one show on Disney+</figcaption></figure><p>With a rich catalog of classic Disney films, animated features, and live-action movies, Disney+ offers a treasure trove of cinematic experiences.</p><p>In addition to movies, Disney+ also boasts an impressive collection of original series that are exclusive to the platform. These shows span various genres, including animated series, live-action dramas, docuseries, and reality shows. They provide viewers with immersive storytelling and the opportunity to delve deeper into the Disney, Marvel, Star Wars, and National Geographic universes.</p><pre>count_data = showtime[&#39;type&#39;].value_counts()<br><br># Create a horizontal bar chart<br>fig = go.Figure(data=go.Bar(<br>    y=count_data.index,<br>    x=count_data.values,<br>    orientation=&#39;h&#39;,<br>    marker=dict(color=[&#39;#01147C&#39;, &#39;#06B2FF&#39;])<br>))<br><br># Set title and axis labels<br>fig.update_layout(<br>    title=&#39;Content on Disney+ &#39;,<br>    xaxis_title=&#39;Count&#39;,<br>    yaxis_title=&#39;Type of Content&#39;, title_x = 0.5<br>)<br>fig.show()</pre><h4>Disney+ focussed on the American audience</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*on3gePBzbG_gj8FjQKXN-g.png" /></figure><p>The United States holds a significant share of the market for Disney+, accounting for approximately 91% of its user base. This dominance in the US market highlights the platform’s popularity and strong presence among American subscribers.</p><p>Following the US, the United Kingdom (GB) holds the second-largest market share for Disney+, with approximately 4.42% of the user base. The platform has also gained traction in Canada (CA), where it holds a market share of around 2.27%.</p><pre>top_countries = pd.DataFrame(showtime[&#39;production_country&#39;].value_counts()[:10])<br>top_countries = top_countries.reset_index()<br>top_countries = top_countries[top_countries[&#39;index&#39;] != &#39;No Data&#39;]<br>top_countries = top_countries.rename(columns = {<br>    &#39;index&#39; : &#39;production_country&#39;,<br>    &#39;production_country&#39; : &#39;content_produced&#39;<br>})<br><br>top_countries = top_countries[:5]<br>fig = px.pie(top_countries, values=&#39;content_produced&#39;, names=&#39;production_country&#39;,<br>             title=&#39;Contribution of Content Produced by Top 5 Countries on Disney+&#39;)<br><br># Change the color palette<br>fig.update_traces(marker=dict(colors=[&#39;#01147C&#39;,&#39;#0000FD&#39;, &#39;#06B2FF&#39;,&#39;#b0ffff&#39;,&#39;#ffffff&#39;]))<br><br># Set the text position and information to be displayed<br>fig.update_traces(textposition=&#39;inside&#39;, textinfo=&#39;percent+label&#39;)<br><br>fig.show()</pre><h4>Where on earth are you watching Disney’s content?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1PNRv1otR_d_8gNBpGqpdQ.png" /></figure><p>In India, approximately 86% of the content consumed on Disney+ is in the form of movies. Similarly, in Canada (CA) and the United States (US), the majority of viewers, around 82% and 72% respectively, engage with movies on the platform. In Australia (AU), movies make up about 68% of the content consumed by audiences.</p><p>However, in countries like South Korea (KR) and Japan (JP), the proportion of movie consumption is relatively lower, accounting for around 40% of the content viewed on Disney+. This suggests that audiences in these regions may have a higher preference for other types of content, such as TV shows, documentaries, or other formats offered by Disney+.</p><pre>country_order = showtime[&#39;production_country&#39;].value_counts()[:11].index<br>data = showtime[[&#39;type&#39;, &#39;production_country&#39;]].groupby(&#39;production_country&#39;)[&#39;type&#39;].value_counts().unstack().loc[country_order]<br>data[&#39;sum&#39;] = data.sum(axis=1)<br>data_ratio = (data.T / data[&#39;sum&#39;]).T[[&#39;MOVIE&#39;, &#39;SHOW&#39;]].sort_values(by=&#39;MOVIE&#39;,ascending=False)[::-1]<br>data_ratio = data_ratio.reset_index()<br>data_ratio = data_ratio[data_ratio[&#39;index&#39;] != &#39;No Data&#39;]<br>data_ratio.rename(columns = {&#39;index&#39;:&#39;country_code&#39;}, inplace = True)<br>data_ratio[&#39;MOVIE&#39;] = round(data_ratio[&#39;MOVIE&#39;], 2)<br>data_ratio[&#39;SHOW&#39;] = round(data_ratio[&#39;SHOW&#39;],2)<br><br>fig = go.Figure()<br><br>fig.add_trace(go.Bar(<br>    y=data_ratio.country_code,<br>    x=data_ratio[&#39;MOVIE&#39;],<br>    name=&#39;MOVIE&#39;,<br>    orientation=&#39;h&#39;,<br>    marker=dict(color=&#39;#01147C&#39;),<br>    text=(data_ratio[&#39;MOVIE&#39;] * 100).astype(str) + &#39;%&#39;,  # Add text as percentages<br>    textposition=&#39;inside&#39;,  # Set text position inside the bars<br>    textfont=dict(color=&#39;white&#39;)  # Set text color<br>))<br><br>fig.add_trace(go.Bar(<br>    y=data_ratio.country_code,<br>    x=data_ratio[&#39;SHOW&#39;],<br>    name=&#39;SHOW&#39;,<br>    orientation=&#39;h&#39;,<br>    marker=dict(color=&#39;#06B2FF&#39;),<br>    text=(data_ratio[&#39;SHOW&#39;] * 100).astype(str) + &#39;%&#39;,  # Add text as percentages<br>    textposition=&#39;inside&#39;,  # Set text position inside the bars<br>    textfont=dict(color=&#39;white&#39;)  # Set text color<br>))<br><br># Set the layout<br>fig.update_layout(<br>    title=&#39;Content Distribution by Country on Disney+&#39;,<br>    barmode=&#39;stack&#39;,<br>    yaxis_title=&#39;Top 10 Countries&#39;,<br>    xaxis=dict(showticklabels=False), title_x = 0.5 # Hide the x-axis tick labels<br>)<br><br>fig.show()</pre><h4>Documentaries! Damn Disney+!</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_W5uqcPvgyYBaO6zV71bkQ.png" /></figure><p>On Disney+, documentary content takes the lead as the highest category of content available on the platform. With its vast collection of informative and educational documentaries, Disney+ offers viewers a wide range of captivating non-fiction content to explore.</p><p>Following documentaries, comedy content holds a prominent position on Disney+. Another genre that Disney+ excels in is animation. With its rich history and expertise in animation, Disney has produced numerous beloved animated movies and series that have become a hallmark of the brand.</p><pre>genre_distribution = pd.DataFrame(showtime.groupby(&#39;primary_genre&#39;)[&#39;type&#39;].value_counts())<br>genre_distribution = genre_distribution.unstack().reset_index().fillna(0).drop(0)<br>genre_distribution[&#39;SUM&#39;] = genre_distribution.sum(axis = 1)<br>genre_distribution.columns = [&#39;primary_genre&#39;, &#39;MOVIE&#39;, &#39;SHOW&#39;, &#39;total&#39;]<br>genre_distribution = genre_distribution.sort_values(&#39;total&#39;, ascending = False)<br>fig1 = go.Figure()<br>fig1.add_trace(go.Bar(<br>    x=genre_distribution[&#39;primary_genre&#39;],<br>    y=genre_distribution[&#39;MOVIE&#39;],<br>    name=&#39;MOVIE&#39;,<br>    marker=dict(color=&#39;#01147C&#39;),<br>))<br><br>fig1.add_trace(go.Bar(<br>    x=genre_distribution[&#39;primary_genre&#39;],<br>    y=genre_distribution[&#39;SHOW&#39;],<br>    name=&#39;SHOW&#39;,<br>    marker=dict(color=&#39;#06B2FF&#39;),<br>))<br><br>fig1.update_layout(<br>    title=&#39;Content Distribution by Genre on Disney+&#39;,<br>    xaxis_title=&#39;Genre&#39;,<br>    yaxis_title=&#39;Content on Disney+&#39;,<br>    barmode=&#39;stack&#39;<br>)<br>fig1.show()</pre><h4>Disney focussed on children… What was your favorite Disney show/movie growing up?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QbS07p0qir3tfS8b7aBzcQ.png" /></figure><p>Disney+ is renowned for being a streaming platform that specially caters to children and families. One of the notable characteristics of Disney+ is its emphasis on providing a safe and family-friendly viewing experience. As a result, the platform boasts the highest proportion of G and PG rated content among all streaming platforms.</p><pre>rating_distribution = pd.DataFrame(showtime.groupby(&#39;age_certification&#39;)[&#39;type&#39;].value_counts())<br># rating_distribution = genre_distribution.unstack().reset_index().fillna(0).drop(0)<br>rating_distribution = rating_distribution.unstack().reset_index().fillna(0)<br>rating_distribution[&#39;SUM&#39;] = rating_distribution.sum(axis = 1)<br>rating_distribution.columns = [&#39;age_certification&#39;,&#39;MOVIE&#39;,&#39;SHOW&#39;,&#39;Total&#39;]<br>rating_distribution = rating_distribution.sort_values(&#39;Total&#39;, ascending = False)<br>rating_distribution = rating_distribution[rating_distribution[&#39;age_certification&#39;]!=&#39;0&#39;]<br>fig2 = go.Figure()<br><br>fig2.add_trace(go.Bar(<br>    x=rating_distribution[&#39;age_certification&#39;],<br>    y=rating_distribution[&#39;MOVIE&#39;],<br>    name=&#39;MOVIE&#39;,<br>    marker=dict(color=&#39;#01147C&#39;),<br><br>))<br><br>fig2.add_trace(go.Bar(<br>    x=rating_distribution[&#39;age_certification&#39;],<br>    y=rating_distribution[&#39;SHOW&#39;],<br>    name=&#39;SHOW&#39;,<br>    marker=dict(color=&#39;#06B2FF&#39;),<br><br>))<br><br>fig2.update_layout(<br>    title=&#39;Content Distribution by Age Rating Certification on Disney+&#39;,<br>    xaxis_title=&#39;Genre&#39;,<br>    yaxis_title=&#39;Content on Disney+&#39;,<br>    barmode=&#39;stack&#39;, legend_title = &#39;Type of Content&#39;, title_x = 0.5<br>)<br><br>fig2.show()</pre><h4>How old is the content on Disney+?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cupa-jsdEE_Ad2ntMU-1Yg.png" /></figure><p>Disney+ offers a rich collection of content that spans across different time periods, including a wide range of titles from the 2000s. The platform allows subscribers to access beloved classics, recent releases, and exclusive content from the Disney, Pixar, Marvel, Star Wars, and National Geographic brands.</p><p>In recent years, Disney+ has significantly increased its online streaming library, providing subscribers with an ever-expanding selection of movies and shows to enjoy. The year 2020, in particular, witnessed a notable surge in the number of movies available on the platform.</p><pre>history = pd.DataFrame(showtime.groupby(&#39;release_year&#39;)[&#39;type&#39;].value_counts())<br>history = history.unstack().reset_index().fillna(0)<br># history[&#39;total&#39;] = history.sum(axis = 1)<br>history.columns = [&#39;release_year&#39;,&#39;MOVIE&#39;,&#39;SHOW&#39;]<br>history = history[(history[&#39;release_year&#39;] &gt;= 2000) &amp; (history[&#39;release_year&#39;] &lt;= 2021)]<br>fig3 = go.Figure()<br>fig3.add_trace(go.Scatter(<br>    x=history[&#39;release_year&#39;],<br>    y=history[&#39;MOVIE&#39;],<br>    mode=&#39;lines&#39;,<br>    name=&#39;MOVIE&#39;,<br>    fill=&#39;tozeroy&#39;,<br>    line=dict(color=&#39;#01147C&#39;)<br>))<br><br>fig3.add_trace(go.Scatter(<br>    x=history[&#39;release_year&#39;],<br>    y=history[&#39;SHOW&#39;],<br>    mode=&#39;lines&#39;,<br>    name=&#39;SHOW&#39;,<br>    fill=&#39;tozeroy&#39;,<br>    line=dict(color=&#39;#06B2FF&#39;)<br>))<br><br># Set the layout<br>fig3.update_layout(<br>    title=&#39;Age of Content on Disney+&#39;,<br>    xaxis_title=&#39;Release Year&#39;,<br>    yaxis_title=&#39;Content on Disney+&#39;, showlegend = True, title_x =0.5<br>)<br>fig3.show()</pre><h4>Kids are Disney’s favorite</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Tx_vDL6MsPX75GU2Fdm8QA.png" /></figure><p>Disney+ has positioned itself as a streaming platform with a primary focus on catering to kids worldwide. With its vast collection of family-friendly content, Disney+ offers a safe and entertaining environment for children to explore and enjoy a wide variety of shows and movies.</p><pre>demographic_data[&#39;target_ages&#39;] = demographic_data[&#39;age_certification&#39;].map(ratings_ages)<br>demographic_data = demographic_data.dropna()<br>demographic_data = demographic_data.groupby([&#39;production_country&#39;, &#39;target_ages&#39;]).size().reset_index(name=&#39;count&#39;).sort_values(&#39;count&#39;, ascending = False)[:20]<br><br>total_count = demographic_data[&#39;count&#39;].sum()<br>demographic_data[&#39;percentage&#39;] = (demographic_data[&#39;count&#39;] / total_count) * 100<br><br>fig = px.treemap(demographic_data, path=[&#39;production_country&#39;, &#39;target_ages&#39;], values=&#39;percentage&#39;,<br>                 color=&#39;target_ages&#39;, color_discrete_sequence= [&#39;#01147C&#39;,&#39;#0000FD&#39;, &#39;#06B2FF&#39;,&#39;#b0ffff&#39;])<br><br>fig.update_layout(title= &quot;Disney+&#39;s Country-Level Target Audience&quot;,<br>                  margin=dict(l=20, r=20, t=40, b=20), title_x = 0.5)  # Adjust the margins as needed<br><br>fig.show()</pre><h4>It’s a tough fight between documentaries and comedy on Disney+!</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VpOuCxld38DzTldvpurjpQ.png" /></figure><p>In the US market, comedy and documentary series have emerged as dominant genres on streaming platforms. These two genres have gained significant popularity among viewers, capturing their attention and becoming a preferred choice for entertainment.</p><pre>demo_genre = showtime.groupby([&#39;production_country&#39;, &#39;primary_genre&#39;]).size().reset_index(name=&#39;count&#39;).sort_values(&#39;count&#39;, ascending = False)[:20]<br>demo_genre = demo_genre[demo_genre[&#39;production_country&#39;]!=&#39;No Data&#39;]<br>fig = px.treemap(demo_genre, path=[&#39;production_country&#39;, &#39;primary_genre&#39;], values=&#39;count&#39;, <br>                    color_discrete_sequence= [&#39;#01147C&#39;,&#39;#0000FD&#39;, &#39;#06B2FF&#39;,&#39;#b0ffff&#39;])<br><br>fig.update_layout(title=&#39;Disney+ Content by Genre and Country&#39;,<br>                  margin=dict(l=20, r=20, t=40, b=20), title_x = 0.5)  # Adjust the margins as needed<br><br>fig.show()</pre><h4>Relationship between IMDb and TMDb scores on Disney+</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wV2NElbjRlX8wfvyvKgxaA.png" /></figure><p>Despite having a larger collection of movies than shows, it is interesting to note that shows on Disney+ tend to receive higher ratings compared to movies. This observation suggests that Disney+ has been successful in curating and producing high-quality shows that resonate with viewers and captivate their interest.</p><pre>fig = px.scatter(showtime, x=&#39;imdb_score&#39;, y=&#39;tmdb_score&#39;, color=&#39;type&#39;,<br>                 color_discrete_map={&#39;MOVIE&#39;: &#39;#01147C&#39;, &#39;SHOW&#39;: &#39;#b0ffff&#39;},<br>                 hover_data=[&#39;title&#39;])<br><br>fig.update_layout(title=&#39;IMDb Score vs TMDB Score&#39;,<br>                  xaxis_title=&#39;IMDb Score&#39;,<br>                  yaxis_title=&#39;TMDB Score&#39;,<br>                  legend_title=&#39;Type&#39;, title_x =0.5)<br><br>fig.show()</pre><h4>Sentiment of Content on Disney+</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5zZ6aEUtdL-vUjMU1vwFUg.png" /><figcaption>Using Roberta model by Hugging Face to categorize movies as Positive, Neutral and Negative based on the description</figcaption></figure><blockquote><a href="https://huggingface.co/docs/transformers/model_doc/roberta">Hugging Face’s Roberta</a> model helps in gauging the sentiment of the content based on the description provided. Roberta excels in understanding context and language patterns and is better at sarcastic sentences, while VADER focuses on sentiment quantification.</blockquote><p>The chart provides a quality assessment for each of the movies using the Roberta model. The model helps us in understanding what type of content is produced by Disney+.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uF-A-TbvwbAsGNRL62HOnQ.png" /><figcaption>53% of content on Disney+ is neutral, 11% is negative and 35% is positive</figcaption></figure><p>On Disney+, a significant portion of the content, approximately 35%, is classified as positive, which is the highest percentage among streaming platforms. This suggests that Disney+ is dedicated to providing a wide array of uplifting and feel-good content that resonates with its audience.</p><pre>showtime[&#39;sentiment&#39;] = showtime.apply(lambda row: &#39;Negative&#39; if row[&#39;roberta_neg&#39;] &gt; 0.5 else (&#39;Neutral&#39; if row[&#39;roberta_neu&#39;] &gt; 0.5 else &#39;Positive&#39;), axis=1)<br>sentiment_counts = showtime[&#39;sentiment&#39;].value_counts()<br><br># Create the donut chart trace<br>fig4 = go.Figure(data=[go.Pie(<br>    labels=sentiment_counts.index,<br>    values=sentiment_counts.values,<br>    hole=0.5,  # Set the hole parameter to create a donut chart<br>    marker=dict(colors=[&#39;#01147C&#39;,&#39;#0000FD&#39;, &#39;#06B2FF&#39;,&#39;#b0ffff&#39;]),  # Set custom colors for the slices<br>    textinfo=&#39;label+percent&#39;,  # Display labels and percentages<br>    textposition=&#39;inside&#39;,  # Set the position of the labels inside the slice<br>)])<br><br># Set the layout<br>fig4.update_layout(<br>    title=&#39;Sentiment Distribution of Content on Disney+&#39;,<br>    showlegend=True, title_x = 0.5, <br>    # Add annotations in the center of the donut pies.<br>    annotations=[dict(text=&#39;Disney+&#39;, x=0.50, y=0.5, font_size=15, showarrow=False)]<br>)<br>fig4.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y5CcVkZcr_dRAz9Bq8lAhw.png" /><figcaption>There is no relationship between the sentiment of the content with the IMDb &amp; TMDb scores</figcaption></figure><p>The lack of a relationship between content sentiment and IMDb/TMDb scores suggests that the audience’s perception of a piece of content goes beyond its sentiment alone. Numerous factors, such as the quality of acting, storytelling, production value, and personal preferences, can influence viewers’ ratings and reviews.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OprzaunGSNhImQhxkGrLQg.png" /></figure><p>On Disney+, documentaries take the lead as the most abundant genre, followed closely by comedy and animation. These genres offer a diverse range of content that caters to various interests and age groups.</p><p>While the neutral sentiment dominates, there is also a significant presence of positive sentiment in these genres. This indicates that Disney+ offers uplifting and enjoyable documentaries, comedic series, and animated shows that resonate with viewers and leave them with a positive experience.</p><p>Additionally, though to a lesser extent, there is some content within these genres that elicits a negative sentiment. This could include documentaries that explore challenging topics or comedy shows that employ dark humor.</p><pre>genre_sentiment = showtime.groupby([&#39;primary_genre&#39;, &#39;sentiment&#39;]).size().reset_index(name=&#39;count&#39;)<br>genre_sentiment = genre_sentiment[genre_sentiment[&#39;primary_genre&#39;]!= &#39;No Data&#39;]<br>genre_sentiment = genre_sentiment.sort_values(&#39;count&#39;, ascending = False)<br><br>colors = [&#39;#01147C&#39;,&#39;#0000FD&#39;, &#39;#06B2FF&#39;,&#39;#b0ffff&#39;,&#39;#ffffff&#39;]<br><br>fig = px.sunburst(genre_sentiment, path=[&#39;primary_genre&#39;, &#39;sentiment&#39;], values=&#39;count&#39;,<br>                  color_discrete_sequence=colors)<br><br>fig.update_layout(title=&#39;Genre vs Sentiments on Disney+&#39;, title_x = 0.5)<br><br>fig.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y7JykDrsNNta2ay19eqAbg.png" /></figure><p>On Disney+, the highest proportion of content is categorized as G (General Audience) rated, followed by PG (Parental Guidance) and TV-PG (Parental Guidance suggested).</p><p>When examining the sentiment distribution within these rating categories, it is observed that the majority of the content falls into the neutral sentiment category. This suggests that Disney+ strives to provide content that maintains a balanced and unbiased tone, appealing to a broad audience without leaning heavily towards any particular emotional tone.</p><p>Following the neutral sentiment, there is a significant presence of positive sentiment in these rating categories. This indicates that Disney+ offers uplifting and enjoyable content that leaves viewers with a positive experience.</p><h4>Any guesses for three words that are most common in Disney titles?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3FJKKAOFqc0TvuEBHBXyzg.png" /></figure><p>The inclusion of “Marvel” in the word cloud signifies the extensive collection of Marvel superhero movies and TV shows available on Disney+. From iconic characters like Iron Man, Spider-Man, and the Avengers to the Guardians of the Galaxy and X-Men, Disney+ offers a treasure trove of Marvel content for fans to enjoy.</p><p>Similarly, the prominence of “Star Wars” in the word cloud highlights the substantial catalog of Star Wars movies, TV series, and animated shows available on Disney+. Fans can delve into the epic space opera saga, exploring the adventures of characters like Luke Skywalker, Darth Vader, and Rey, among many others.</p><pre>showtime[&#39;title&#39;] = showtime[&#39;title&#39;].astype(str)<br>title_corpus = &#39; &#39;.join(showtime[&#39;title&#39;])<br>from wordcloud import WordCloud, STOPWORDS, ImageColorGenerator<br>stopwords = set(STOPWORDS)<br><br># Define a function to specify the text color<br>def disney_color(word, font_size, position, orientation, random_state=None, **kwargs):<br>    return &quot;#ffffff&quot;<br><br>custom_mask = np.array(Image.open(&#39;logo2.jpg.webp&#39;)) <br>wc = WordCloud(<br>               stopwords = stopwords,<br>               mask = custom_mask,height = 2000, width = 4000, color_func = disney_color)<br>#background_color = &#39;white&#39;,<br>wc.generate(title_corpus)<br><br>plt.figure(figsize=(16,8))<br>plt.imshow(wc, interpolation = &#39;bilinear&#39;)<br>plt.axis(&#39;off&#39;)<br>plt.show()</pre><p>Disney+ stands out for its emphasis on high-quality original programming, featuring exclusive content that cannot be found elsewhere. Additionally, Disney+’s dedication to providing a safe and inclusive environment for viewers of all ages is reflected in its predominantly G and PG rated content, ensuring that families can enjoy the platform together.</p><p>Furthermore, the sentiment analysis reveals that Disney+ content leans towards a neutral and positive tone, promoting uplifting and enjoyable experiences for viewers. The platform’s commitment to storytelling, memorable characters, and immersive universes has made it a hub for Marvel and Star Wars enthusiasts, as indicated by their prominent presence in the word cloud of content titles.</p><p>The project code is available on my Github: <a href="https://github.com/shrunalisalian/Movie-Recommendation-System">https://github.com/shrunalisalian/Movie-Recommendation-System</a></p><p>Disney Dataset on Kaggle: <a href="https://www.kaggle.com/datasets/dgoenrique/disney-movies-and-tv-shows">https://www.kaggle.com/datasets/dgoenrique/disney-movies-and-tv-shows</a></p><p>Feel free to let me know if you have any suggestions. Thank You for reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=516662799258" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Streaming Wars with Sentiment Analysis using Roberta model: HBO Max]]></title>
            <link>https://medium.com/@shrunalisalian97/streaming-wars-hbo-max-9109a32bac1?source=rss-97aa7b72566b------2</link>
            <guid isPermaLink="false">https://medium.com/p/9109a32bac1</guid>
            <dc:creator><![CDATA[Shrunali Suresh Salian]]></dc:creator>
            <pubDate>Tue, 06 Jun 2023 17:51:12 GMT</pubDate>
            <atom:updated>2023-06-07T03:30:33.515Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://www.nexttv.com/news/hbo-max">Nearly three years after HBO Max’s launch, AT&amp;T announced plans to sell parent unit WarnerMedia to Discovery.</a> The deal effectively pulls AT&amp;T out of the content waters. AT&amp;T paid $85 billion for Time Warner Inc. three years ago. Its deal with Discovery <a href="https://www.nexttv.com/news/atandt-and-discovery-merge-media-assets-forming-tv-giant">values the WarnerMedia assets at $43 billion</a> worth of cash and debt.</p><p>HBO Max is a popular streaming platform that offers a vast array of content from the renowned HBO network, movies, TV shows, and exclusive original programming. Launched in May 2020, HBO Max quickly established itself as a prominent player in the streaming industry.</p><p>HBO Max saw the biggest rise in market share from <strong>10% to 15%</strong> in 2021/22. It has <strong>14% market share</strong> size in the US, a <strong>1% less</strong> than Disney+. It had the biggest market share in Q1 2022. At 21%, it had a 4% lead over Disney+ and a 6% lead over Netflix’s app.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YeG-Wr7zRwprU3yciULXmQ.png" /></figure><p>The platform includes a diverse range of exclusive original programming. HBO Max’s original content has received critical acclaim and has helped to establish the platform as a home for high-quality and compelling storytelling.</p><p>While the platform may not offer the same volume of content as some of its competitors, it prioritizes delivering a curated selection of top-notch programming like “Game of Thrones,” “The Sopranos,” “Westworld,” and “Succession.”</p><p>The article is based on the Kaggle dataset available for HBO Max . It’s important to note that the analysis and conclusions based on the dataset for HBO Max may not reflect the current trends and offerings of HBO Max. The dataset provides insights based on a specific time period and may not capture the most up-to-date information or changes in the streaming platform.</p><h4>Are you a movie person or a tv show person?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lHC5qXgxBlGhMb3RxiS15A.png" /><figcaption>For every 4 movies on HBO Max there’s one TV Show</figcaption></figure><p>This distribution showcases HBO Max’s commitment to offering a diverse range of content, catering to the preferences of both movie enthusiasts and TV series aficionados.</p><pre>count_data = showtime[&#39;type&#39;].value_counts()<br><br># Create a horizontal bar chart<br>fig = go.Figure(data=go.Bar(<br>    y=count_data.index,<br>    x=count_data.values,<br>    orientation=&#39;h&#39;,<br>    marker=dict(color=[&#39;#7A6BE2&#39;, &#39;#7BA7F2&#39;])<br>))<br><br># Set title and axis labels<br>fig.update_layout(<br>    title=&#39;Content on HBO Max&#39;,<br>    xaxis_title=&#39;Count&#39;,<br>    yaxis_title=&#39;Type of Content&#39;, title_x = 0.5<br>)<br>fig.show()</pre><h4>HBO Max doing great on home ground</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NllCxkYY3IwO342clC70Vg.png" /><figcaption>Top 4 countries of HBO Max audience</figcaption></figure><p>HBO Max’s market share is dominated by the United States, which holds a significant 83% share of the platform’s user base. This indicates a strong presence and popularity within its home country, where HBO Max has likely gained traction through its established brand recognition and content offerings.</p><p>Following the United States, the United Kingdom holds the second-largest market share for HBO Max, with 8.3%. In addition to the UK, France (4.46%) and Japan (4.15%) also contribute to HBO Max’s market share, albeit to a lesser extent.</p><pre>top_countries = pd.DataFrame(showtime[&#39;production_country&#39;].value_counts()[:10])<br>top_countries = top_countries.reset_index()<br>top_countries = top_countries[top_countries[&#39;index&#39;] != &#39;No Data&#39;]<br>top_countries = top_countries[:4]<br>fig = px.pie(top_countries, values=&#39;content_produced&#39;, names=&#39;production_country&#39;,<br>             title=&#39;Contribution of Content Produced by Top 4 Countries on HBO Max&#39;)<br><br># Change the color palette<br>fig.update_traces(marker=dict(colors=[&#39;#000000&#39;, &#39;#941DE8&#39;,&#39;#7A6BE2&#39;,&#39;#7BA7F2&#39;]))<br><br># Set the text position and information to be displayed<br>fig.update_traces(textposition=&#39;inside&#39;, textinfo=&#39;percent+label&#39;)<br># fig.update_traces(title_x = 0.5)<br><br>fig.show()</pre><h4>Does your country determine what you’d be watching tonight?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*skhndS_MKorivRvOUPxohg.png" /><figcaption>Looks like the Italians and the French love watching HBO Max movies</figcaption></figure><p>In Italy (IT) and France (FR), a significant majority of viewers, accounting for 97% of the audience, prefer watching movies on HBO Max. Similarly, in Japan (JP), Australia (AU), and Germany (DE), over 90% of viewers lean towards movies on HBO Max.</p><p>On the other hand, in Spain (ES), a notable proportion of the audience, representing 47%, gravitates towards shows on HBO Max. This indicates a higher demand for TV series and suggests that episodic storytelling and long-form narratives are favored by viewers in Spain.</p><pre>country_order = showtime[&#39;production_country&#39;].value_counts()[:11].index<br>data = showtime[[&#39;type&#39;, &#39;production_country&#39;]].groupby(&#39;production_country&#39;)[&#39;type&#39;].value_counts().unstack().loc[country_order]<br>data[&#39;sum&#39;] = data.sum(axis=1)<br>data_ratio = (data.T / data[&#39;sum&#39;]).T[[&#39;MOVIE&#39;, &#39;SHOW&#39;]].sort_values(by=&#39;MOVIE&#39;,ascending=False)[::-1]<br>data_ratio = data_ratio.reset_index()<br>data_ratio = data_ratio[data_ratio[&#39;index&#39;] != &#39;No Data&#39;]<br>data_ratio.rename(columns = {&#39;index&#39;:&#39;country_code&#39;}, inplace = True)<br>data_ratio[&#39;MOVIE&#39;] = round(data_ratio[&#39;MOVIE&#39;], 2)<br>data_ratio[&#39;SHOW&#39;] = round(data_ratio[&#39;SHOW&#39;],2)<br>fig = go.Figure()<br><br>fig.add_trace(go.Bar(<br>    y=data_ratio.country_code,<br>    x=data_ratio[&#39;MOVIE&#39;],<br>    name=&#39;MOVIE&#39;,<br>    orientation=&#39;h&#39;,<br>    marker=dict(color=&#39;#941DE8&#39;),<br>    text=(data_ratio[&#39;MOVIE&#39;] * 100).astype(str) + &#39;%&#39;,  # Add text as percentages<br>    textposition=&#39;inside&#39;,  # Set text position inside the bars<br>    textfont=dict(color=&#39;white&#39;)  # Set text color<br>))<br><br>fig.add_trace(go.Bar(<br>    y=data_ratio.country_code,<br>    x=data_ratio[&#39;SHOW&#39;],<br>    name=&#39;SHOW&#39;,<br>    orientation=&#39;h&#39;,<br>    marker=dict(color=&#39;#7BA7F2&#39;),<br>    text=(data_ratio[&#39;SHOW&#39;] * 100).astype(str) + &#39;%&#39;,  # Add text as percentages<br>    textposition=&#39;inside&#39;,  # Set text position inside the bars<br>    textfont=dict(color=&#39;white&#39;)  # Set text color<br>))<br><br># Set the layout<br>fig.update_layout(<br>    title=&#39;Content Distribution by Country on HBO Max&#39;,<br>    barmode=&#39;stack&#39;,<br>    yaxis_title=&#39;Top 10 Countries&#39;,<br>    xaxis=dict(showticklabels=False), title_x = 0.5 # Hide the x-axis tick labels<br>)<br><br>fig.show()</pre><h4>Drama reigns supreme once more!</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FkrsyWDzD9Jy5nYSGgLYUA.png" /><figcaption>Drama movies hold the top position in terms of quantity, followed by comedy and documentaries.</figcaption></figure><p>This distribution of content genres reflects the platform’s emphasis on offering a diverse range of cinematic experiences to cater to the varied tastes and preferences of its audience.</p><pre>genre_distribution = pd.DataFrame(showtime.groupby(&#39;primary_genre&#39;)[&#39;type&#39;].value_counts())<br>genre_distribution = genre_distribution.unstack().reset_index().fillna(0).drop(0)<br>genre_distribution[&#39;SUM&#39;] = genre_distribution.sum(axis = 1)<br>genre_distribution.columns = [&#39;primary_genre&#39;, &#39;MOVIE&#39;, &#39;SHOW&#39;, &#39;total&#39;]<br>genre_distribution = genre_distribution.sort_values(&#39;total&#39;, ascending = False)<br>fig1 = go.Figure()<br>fig1.add_trace(go.Bar(<br>    x=genre_distribution[&#39;primary_genre&#39;],<br>    y=genre_distribution[&#39;MOVIE&#39;],<br>    name=&#39;MOVIE&#39;,<br>    marker=dict(color=&#39;#000000&#39;),<br>))<br><br>fig1.add_trace(go.Bar(<br>    x=genre_distribution[&#39;primary_genre&#39;],<br>    y=genre_distribution[&#39;SHOW&#39;],<br>    name=&#39;SHOW&#39;,<br>    marker=dict(color=&#39;#7BA7F2&#39;),<br>))<br><br>fig1.update_layout(<br>    title=&#39;Content Distribution by Genre on HBO Max&#39;,<br>    xaxis_title=&#39;Genre&#39;,<br>    yaxis_title=&#39;Content on HBO Max&#39;,<br>    barmode=&#39;stack&#39;<br>)<br>fig1.show()</pre><h4>For mature audiences only!</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SxihJEdJYTh6zdHgi1A47w.png" /><figcaption>R-rated movies have the highest representation in terms of quantity, followed by movies with a PG-13 rating</figcaption></figure><p>This distribution indicates a significant presence of mature content on the platform, catering to viewers who enjoy films with more explicit content, intense themes, and adult-oriented storytelling.</p><pre>rating_distribution = pd.DataFrame(showtime.groupby(&#39;age_certification&#39;)[&#39;type&#39;].value_counts())<br># rating_distribution = genre_distribution.unstack().reset_index().fillna(0).drop(0)<br>rating_distribution = rating_distribution.unstack().reset_index().fillna(0)<br>rating_distribution[&#39;SUM&#39;] = rating_distribution.sum(axis = 1)<br>rating_distribution.columns = [&#39;age_certification&#39;,&#39;MOVIE&#39;,&#39;SHOW&#39;,&#39;Total&#39;]<br>rating_distribution = rating_distribution.sort_values(&#39;Total&#39;, ascending = False)<br>fig2 = go.Figure()<br><br>fig2.add_trace(go.Bar(<br>    x=rating_distribution[&#39;age_certification&#39;],<br>    y=rating_distribution[&#39;MOVIE&#39;],<br>    name=&#39;MOVIE&#39;,<br>    marker=dict(color=&#39;#000000&#39;),<br><br>))<br><br>fig2.add_trace(go.Bar(<br>    x=rating_distribution[&#39;age_certification&#39;],<br>    y=rating_distribution[&#39;SHOW&#39;],<br>    name=&#39;SHOW&#39;,<br>    marker=dict(color=&#39;#7BA7F2&#39;),<br><br>))<br><br>fig2.update_layout(<br>    title=&#39;Content Distribution by Age Rating Certification&#39;,<br>    xaxis_title=&#39;Genre&#39;,<br>    yaxis_title=&#39;Content on HBO Max&#39;,<br>    barmode=&#39;stack&#39;, legend_title = &#39;Type of Content&#39;, title_x = 0.5<br>)<br><br>fig2.show()</pre><h4>How old is the content on HBO Max?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*59_23Qtj2FT1FGDHWyWSIA.png" /><figcaption>More recent content is being uploaded on HBO Max</figcaption></figure><p>HBO Max has been consistently uploading more recent content to its platform, ensuring that subscribers have access to a fresh and up-to-date library of movies and shows.</p><pre>history = pd.DataFrame(showtime.groupby(&#39;release_year&#39;)[&#39;type&#39;].value_counts())<br>history = history.unstack().reset_index().fillna(0)<br># history[&#39;total&#39;] = history.sum(axis = 1)<br>history.columns = [&#39;release_year&#39;,&#39;MOVIE&#39;,&#39;SHOW&#39;]<br>history = history[(history[&#39;release_year&#39;] &gt;= 2000) &amp; (history[&#39;release_year&#39;] &lt;= 2021)]<br>fig3 = go.Figure()<br>fig3.add_trace(go.Scatter(<br>    x=history[&#39;release_year&#39;],<br>    y=history[&#39;MOVIE&#39;],<br>    mode=&#39;lines&#39;,<br>    name=&#39;MOVIE&#39;,<br>    fill=&#39;tozeroy&#39;,<br>    line=dict(color=&#39;#000000&#39;)<br>))<br><br>fig3.add_trace(go.Scatter(<br>    x=history[&#39;release_year&#39;],<br>    y=history[&#39;SHOW&#39;],<br>    mode=&#39;lines&#39;,<br>    name=&#39;SHOW&#39;,<br>    fill=&#39;tozeroy&#39;,<br>    line=dict(color=&#39;#7BA7F2&#39;)<br>))<br><br># Set the layout<br>fig3.update_layout(<br>    title=&#39;Content Trend  on HBO Max over the Years&#39;,<br>    xaxis_title=&#39;Release Year&#39;,<br>    yaxis_title=&#39;Content on HBO Max&#39;, showlegend = True, title_x =0.5<br>)<br>fig3.show()</pre><h4>An adult in US, good chance you’d be streaming content on HBO Max</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F1oQFPYuPh6zjf9MNk2Odw.png" /><figcaption>HBO Max has more of an adult target audience</figcaption></figure><p>HBO Max is known for its emphasis on catering to an adult target audience. HBO Max’s commitment to producing original programming with edgier and more adult-oriented content further solidifies its appeal to an adult target audience. The platform is known for pushing creative boundaries and exploring complex subject matter, offering a sophisticated viewing experience that caters to the discerning tastes of adult viewers.</p><pre>total_count = demographic_data[&#39;count&#39;].sum()<br>demographic_data[&#39;percentage&#39;] = (demographic_data[&#39;count&#39;] / total_count) * 100<br><br>fig = px.treemap(demographic_data, path=[&#39;production_country&#39;, &#39;target_ages&#39;], values=&#39;percentage&#39;,<br>                 color=&#39;target_ages&#39;, color_discrete_sequence= [&#39;#000000&#39;, &#39;#941DE8&#39;,&#39;#7A6BE2&#39;,&#39;#7BA7F2&#39;])<br><br>fig.update_layout(title= &quot;HBO Max&#39;s Country-Level Target Audience&quot;,<br>                  margin=dict(l=20, r=20, t=40, b=20), title_x = 0.5)  # Adjust the margins as needed<br><br>fig.show()</pre><h4>Comedy content on HBO Max, count me in!</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BNWIhslmX4lbNzLx3eWwQw.png" /><figcaption>HBO Max offers a diverse range of content tailored to the preferences of different regions.</figcaption></figure><p>In the United States, the platform’s library is rich in comedy content, making it a go-to destination for viewers seeking laughter and light-hearted entertainment. On the other hand, in the United Kingdom (UK), France (FR), and Japan (JP), drama content takes center stage on HBO Max.</p><h4>You may watch more movies but you like shows better 😏</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8TLNLp-pI0oGRjxqC9reqA.png" /><figcaption>HBO Max shows are rated higher than movies</figcaption></figure><p>On HBO Max, shows tend to receive higher ratings compared to movies, indicating that the platform’s original and curated series are highly regarded by viewers. This suggests that HBO Max has been successful in producing and acquiring high-quality shows that resonate with audiences and receive critical acclaim.</p><pre>fig = px.scatter(showtime, x=&#39;imdb_score&#39;, y=&#39;tmdb_score&#39;, color=&#39;type&#39;,<br>                 color_discrete_map={&#39;MOVIE&#39;: &#39;#000000&#39;, &#39;SHOW&#39;: &#39;#7BA7F2&#39;},<br>                 hover_data=[&#39;title&#39;])<br><br>fig.update_layout(title=&#39;IMDb Score vs TMDB Score&#39;,<br>                  xaxis_title=&#39;IMDb Score&#39;,<br>                  yaxis_title=&#39;TMDB Score&#39;,<br>                  legend_title=&#39;Type&#39;, title_x =0.5)<br><br>fig.show()</pre><h4>Negative or Positive Content?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N-kt0vi-z5MuGpwg-VXiMQ.png" /><figcaption>Using Roberta model by Hugging Face to categorize movies as Positive, Neutral and Negative based on the description</figcaption></figure><blockquote><a href="https://huggingface.co/docs/transformers/model_doc/roberta">Hugging Face’s Roberta</a> model helps in gauging the sentiment of the content based on the description provided. Roberta excels in understanding context and language patterns and is better at sarcastic sentences, while VADER focuses on sentiment quantification.</blockquote><p>The chart provides a quality assessment for each of the movies using the Roberta model. The model helps us in understanding what type of content is produced by HBO Max.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0kwYmicYFKCvbKr7llv6Rg.png" /><figcaption>53% of content on HBO Max is neutral, 26% is negative and 20% is positive</figcaption></figure><p>According to data, approximately 53% of the content available on HBO Max is categorized as neutral. This indicates that a significant portion of the content falls within a balanced range, neither strongly positive nor negative in sentiment.</p><p>Around 26% of the content is classified as negative, suggesting that HBO Max also features programming that explores darker or more challenging subject matter. This could include content with intense themes, conflict, or narratives that evoke a range of emotions. Such content provides viewers with thought-provoking and emotionally impactful experiences.</p><p>Approximately 20% of the content on HBO Max is categorized as positive. This indicates a significant presence of content that offers uplifting, inspirational, or feel-good elements.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JsnbrmgpHXK5QmPhzlf2ZQ.png" /><figcaption>Is there any relationship between the sentiment of the content with the IMDb &amp; TMDb scores?</figcaption></figure><p>It appears that there is no discernible relationship between the sentiment of the content on HBO Max and the IMDb and TMDb scores. Regardless of whether the content is categorized as positive, negative, or neutral, the ratings assigned by viewers on these platforms remain relatively consistent.</p><p>This finding suggests that viewers’ opinions and evaluations of the content are not strongly influenced by its sentiment. Instead, other factors such as the overall quality, storytelling, production values, performances, and personal preferences seem to play a more significant role in determining the IMDb and TMDb scores.</p><p>It is worth noting that IMDb and TMDb scores are subjective and represent the collective ratings provided by users. While sentiment can contribute to viewers’ perceptions of the content, it is just one aspect among many that shape their opinions and evaluations.</p><p>The lack of a significant relationship between sentiment and ratings underscores the importance of providing diverse content on HBO Max that caters to various tastes and preferences. By offering a wide range of genres, themes, and storytelling approaches, HBO Max aims to appeal to a broad audience, ensuring that viewers can find content that aligns with their individual interests, regardless of its sentiment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a_HmVeZDCQN3Jw5ePuWsyw.png" /><figcaption>Majority of drama content aims to provide a balanced portrayal of emotions and storytelling, with a notable presence of more intense or challenging narratives.</figcaption></figure><p>Comedy: Comedy content on HBO Max is characterized by a higher proportion of neutral offerings, followed by positive, and then negative which suggests a light-hearted and entertaining experiences while maintaining a balanced tone overall.</p><p>Documentaries: Within the documentary genre, the content is primarily classified as neutral, followed by positive, and then negative. This indicates that HBO Max offers a significant number of informative and educational documentaries that provide viewers with a balanced perspective on various subjects.</p><p>Thriller: In the thriller genre, the content is predominantly categorized as negative, followed by neutral. This suggests that thrillers on HBO Max often delve into darker and more suspenseful themes, aiming to evoke a sense of tension and unease.</p><pre>genre_sentiment = showtime.groupby([&#39;primary_genre&#39;, &#39;sentiment&#39;]).size().reset_index(name=&#39;count&#39;)<br>genre_sentiment = genre_sentiment[genre_sentiment[&#39;primary_genre&#39;]!= &#39;No Data&#39;]<br>genre_sentiment = genre_sentiment.sort_values(&#39;count&#39;, ascending = False)<br>colors = [&#39;#000000&#39;, &#39;#941DE8&#39;,&#39;#7A6BE2&#39;,&#39;#7BA7F2&#39;]<br><br>fig = px.sunburst(genre_sentiment, path=[&#39;primary_genre&#39;, &#39;sentiment&#39;], values=&#39;count&#39;,<br>                  color_discrete_sequence=colors)<br><br>fig.update_layout(title=&#39;Sentiments based Genre Strategy on HBO Max&#39;, title_x = 0.5)<br><br>fig.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_hzzcSh6KM09uMLgSYK_RA.png" /><figcaption>It is important to note that the sentiment analysis is based on an interpretation of the content and may not capture all nuances.</figcaption></figure><p>R-rated movies cater to a diverse range of emotions and themes, providing a balanced portrayal of storytelling that can evoke different responses from viewers.</p><p>Within the PG-13 category, the sentiment distribution follows a similar pattern with a higher presence of neutral content, followed by negative and then positive. This indicates that PG-13 movies on HBO Max aim to strike a balance between engaging storytelling and age-appropriate content, encompassing a variety of themes and emotional experiences.</p><h4>What are your favorite movies/shows on HBO Max?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A91wT2T28liN6WnqC8Wu3Q.png" /><figcaption>Word cloud of titles of content on HBO Max</figcaption></figure><p>The presence of “Batman” and “Scooby Doo” as prominent words in the word cloud suggests that HBO Max offers content related to these well-known franchises, catering to fans of these iconic characters and their respective universes.</p><pre># Define a function to specify the text color<br>def hbo_color(word, font_size, position, orientation, random_state=None, **kwargs):<br>    return &quot;#7BA7F2&quot;<br><br>custom_mask = np.array(Image.open(&#39;max-logo-1.jpg.webp&#39;)) <br>wc = WordCloud(<br>               stopwords = stopwords,<br>               mask = custom_mask,height = 2000, width = 4000, color_func = hbo_color)<br>#background_color = &#39;white&#39;,<br>wc.generate(title_corpus)<br><br>plt.figure(figsize=(16,8))<br>plt.imshow(wc, interpolation = &#39;bilinear&#39;)<br>plt.axis(&#39;off&#39;)<br>plt.show()</pre><h4>For how long would you be watching TV?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x_DgrCvuXX45Fp51lj10vQ.png" /><figcaption>Runtime of content on HBO Max</figcaption></figure><p>It is evident that the distribution does not follow a smooth bell curve. Instead, it indicates the presence of a diverse range of content with varying durations. The data suggests that HBO Max offers a significant number of both short-format and long-format content. The highest number of content falls within the average runtime of 90 minutes.</p><pre>colors = [&#39;#000000&#39;, &#39;#941DE8&#39;,&#39;#7A6BE2&#39;,&#39;#7BA7F2&#39;]<br><br>fig = px.histogram(showtime, x=&#39;runtime&#39;, color_discrete_sequence=colors)<br><br># Customize the layout if needed<br>fig.update_layout(<br>    title=&#39;Content Runtime Distribution on HBO Max&#39;,<br>    xaxis_title=&#39;Runtime&#39;,<br>    yaxis_title=&#39;Count of Content&#39;, title_x = 0.5, bargap=0.2<br>)<br><br>fig.show()</pre><p>HBO Max has emerged as a formidable player in the competitive field of OTT streaming, thanks to its renowned and exclusive original programming. This early success has solidified their position as a strong contender in the industry. While their primary focus remains on the US market, HBO Max’s exceptional content sets a high standard, challenging both Netflix and Amazon to elevate their game.</p><p>Despite a significant portion of HBO Max’s content catering to mature audiences, leading to a slightly higher percentage of negative content, they have not overlooked the younger crowd. Shows like Batman and Scooby Doo have garnered high ratings, demonstrating their ability to captivate diverse age groups.</p><p>The project code is available on my Github: <a href="https://github.com/shrunalisalian/Streaming-Wars">https://github.com/shrunalisalian/Streaming-Wars</a></p><p>HBO Max Dataset on Kaggle: <a href="https://www.kaggle.com/datasets/dgoenrique/hbo-max-movies-and-tv-shows">https://www.kaggle.com/datasets/dgoenrique/hbo-max-movies-and-tv-shows</a></p><p>In case you enjoyed reading this article, feel free to check out articles on <a href="https://medium.com/@shrunalisalian97/streaming-wars-3aad80f5a305">Amazon Prime Video</a>, <a href="https://medium.com/@shrunalisalian97/streaming-wars-netflix-c314fa95cc2e">Netflix</a>, <a href="https://medium.com/@shrunalisalian97/streaming-wars-disney-516662799258">Disney</a>+ , <a href="https://medium.com/@shrunalisalian97/streaming-wars-paramount-27846654f387">Paramount+</a> and <a href="https://medium.com/@shrunalisalian97/streaming-wars-apple-tv-7b86698e40de">Apple TV+</a></p><p>Feel free to let me know if you have any suggestions. Thank You for reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9109a32bac1" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>