<?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 Vojtěch Sýkora on Medium]]></title>
        <description><![CDATA[Stories by Vojtěch Sýkora on Medium]]></description>
        <link>https://medium.com/@sykoravojtech?source=rss-57a4d3efed9c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*hP239i0dMs4HA11G.jpg</url>
            <title>Stories by Vojtěch Sýkora on Medium</title>
            <link>https://medium.com/@sykoravojtech?source=rss-57a4d3efed9c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 14:47:44 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sykoravojtech/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[Running a Full LLM Model Offline on Your Phone]]></title>
            <link>https://medium.com/@sykoravojtech/running-a-full-llm-model-offline-on-your-phone-0a707c8bcaa0?source=rss-57a4d3efed9c------2</link>
            <guid isPermaLink="false">https://medium.com/p/0a707c8bcaa0</guid>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[google]]></category>
            <category><![CDATA[gemma]]></category>
            <category><![CDATA[chatbots]]></category>
            <dc:creator><![CDATA[Vojtěch Sýkora]]></dc:creator>
            <pubDate>Wed, 04 Jun 2025 14:01:22 GMT</pubDate>
            <atom:updated>2025-06-04T14:01:22.761Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/821/1*NnrZB3L8gSg6aS2QFyqa4w.png" /><figcaption><a href="https://github.com/google-ai-edge/gallery">https://github.com/google-ai-edge/gallery</a></figcaption></figure><p><strong>Your pocket has just become a test lab.</strong> Running a full-size large language model (LLM) on a phone is no longer science fiction. It is something anyone with a modern phone and a quiet afternoon can pull off, no internet signal required. I tried it on a Pixel 8 Pro and watched it spit out words while in aeroplane mode. Here is how and why it matters.</p><h3>What &amp; Where</h3><p>Google’s AI Edge Gallery lives on GitHub at <a href="https://github.com/google-ai-edge/gallery">https://github.com/google-ai-edge/gallery</a>. Once you install the APK, the app presents three main sections: <strong>Prompt Lab models</strong>, <strong>AI Chat models</strong> and <strong>Ask Image models</strong>. Under each heading you will see a list of model names, along with their on-disk size. For example:</p><p><strong>Prompt Lab models</strong>:</p><ul><li>Gemma-3n-E2B-it-int4 (3.1 GB)</li><li>Gemma-3n-E4B-it-int4 (4.4 GB)</li><li>Gemma3–1B-IT q4 (554.7 MB)</li><li>Qwen2.5–1.5B-Instruct q8 (1.6 GB)</li></ul><p><strong>AI Chat models</strong> (same list and sizes, but optimised for chat use)</p><p><strong>Ask Image models</strong> (Gemma variants with vision support)</p><p>Each model listed in the app is hosted on Hugging Face, so you will need a free Hugging Face account and must click Accept on each model’s licence card before downloading. Once you accept, a tap on the green download icon brings the selected binary onto your phone.</p><p>Most of the smaller, text-focused LLMs weigh in around 200 MB once quantised. On a Pixel 8 Pro, one such distilled Gemma model delivered roughly <strong>2 words s⁻¹</strong>, which in practice means you see a one-sentence answer in a second or two.</p><h3>My Experiments</h3><p>I downloaded the <strong>Gemma-3n-E4B-it-int4</strong> model from the <strong>Ask Image models</strong> section. Once the 4.4 GB binary finished downloading, I pointed the camera outside my window, snapped a quick photo and asked the model to describe what it saw and guess my country. It correctly identified the country and gave a close guess at my city. There were no errors or hiccups, and it all ran fully offline.</p><p>The phone did warm up a little after about three queries, but the app never crashed or slowed down. In aeroplane mode, it stayed responsive, and during 15 minutes of testing, the temperature never got too hot.</p><h3>Why This Matters</h3><ul><li><strong>Privacy</strong> — All prompts, photos, and outputs stay on the handset. There is no server log of your queries.</li><li><strong>Zero latency</strong> — Plane, train, or countryside, it just works. No waiting for packet round-trip.</li><li><strong>Cost control</strong> — No API bills or unexpected roaming fees.</li><li><strong>Local vision tasks</strong> — Once you download a vision-capable binary like Gemma-3n-E4B-it-int4, you can ask questions about any image landscapes, documents, whatever, without ever touching cloud servers.</li></ul><p>Cloud LLMs will always be bigger, but they risk leaking your data and choking if 5 G drops to 3 G. Local models hand control back to the user.</p><h3>Looking Ahead</h3><p>Compression and quantisation techniques are advancing quickly. Within the next two years, hardware improvements and smarter model pruning will mean that <strong>flagship phones might ship with built-in LLMs that rival today’s mid-tier cloud services</strong>. Imagine an always-on, privacy-preserving assistant that understands text, voice, and images locally. That day is closer than you think.</p><h3>Sources &amp; Links</h3><ul><li>Techweez: <a href="https://techweez.com/2025/06/04/google-launches-app-to-run-ai-models-android/?utm_source=chatgpt.com">https://techweez.com/2025/06/04/google-launches-app-to-run-ai-models-android/?utm_source=chatgpt.com</a></li><li>Economic Times: <a href="https://economictimes.indiatimes.com/tech/artificial-intelligence/google-lets-android-phones-run-ai-models-without-internet/articleshow/121537756.cms?utm_source=chatgpt.com">https://economictimes.indiatimes.com/tech/artificial-intelligence/google-lets-android-phones-run-ai-models-without-internet/articleshow/121537756.cms?utm_source=chatgpt.com</a></li><li>TechCrunch: <a href="https://techcrunch.com/2025/05/31/google-quietly-released-an-app-that-lets-you-download-and-run-ai-models-locally/?utm_source=chatgpt.com">https://techcrunch.com/2025/05/31/google-quietly-released-an-app-that-lets-you-download-and-run-ai-models-locally/?utm_source=chatgpt.com</a></li><li>GitHub repo: <a href="https://github.com/google-ai-edge/gallery">https://github.com/google-ai-edge/gallery</a></li><li>Hugging Face model hub: <a href="https://huggingface.co/">https://huggingface.co</a></li></ul><p>And yes, your phone will get warm, but that is part of the fun.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0a707c8bcaa0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Faster R-CNN, Explained Like You’re Waiting at Airport Security ✈️]]></title>
            <link>https://medium.com/@sykoravojtech/faster-r-cnn-explained-like-youre-waiting-at-airport-security-%EF%B8%8F-dd4fb798da9b?source=rss-57a4d3efed9c------2</link>
            <guid isPermaLink="false">https://medium.com/p/dd4fb798da9b</guid>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[pytorch]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[object-detection]]></category>
            <category><![CDATA[faster-rcnn]]></category>
            <dc:creator><![CDATA[Vojtěch Sýkora]]></dc:creator>
            <pubDate>Sat, 26 Apr 2025 09:58:31 GMT</pubDate>
            <atom:updated>2025-04-26T10:01:34.801Z</atom:updated>
            <content:encoded><![CDATA[<h3>What’s Going On?</h3><p>Imagine Heathrow on a bank-holiday Friday. In the <em>old</em> days, every suitcase went through two full scans: first a quick X-ray, then a manual rummage. Chaos. Faster R-CNN fixes the queue. A tiny neural “gate agent” called the <em>Region Proposal Network</em> (RPN) skims the X-ray feed, raising its hand only when it spots a shape that looks vaguely suitcase-ish. The heavyweight scanner (Fast R-CNN) then inspects <em>only those</em> regions. Fewer false alarms, far shorter waiting times.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/920/0*eaoQxqS36EPZw3gE.jpg" /></figure><h3>Everyday Analogy</h3><ul><li><strong>Backbone CNN = X-ray belt</strong> — spits out a feature map of the whole scene.</li><li><strong>RPN = gate agent with prefab suitcase sizes (anchors)</strong> — barks “check here, here, here…”.</li><li><strong>RoI Align = resize desk</strong> — squeezes each flagged patch into a fixed 7 × 7 grid so the next stage can cope.</li><li><strong>Heads = mini experts</strong> — one says <em>what</em> the object is, the other nudges the bounding box to fit snugly.</li></ul><h3>Where You’ll Meet It</h3><p>Traffic-light detection in autonomous cars, tumour spotting in MRI scans, retail-shelf analytics, drone-based search-and-rescue — the list grows because two-stage detectors still rule where <em>missing one pixel costs big</em>.</p><h3>Strengths</h3><p>Pin-sharp localisation, graceful handling of tiny or overlapping objects, still the “gold baseline” every flashy detector must beat.</p><h3>Limitations</h3><p>Seven-ish FPS on a single GPU with a VGG-16 backbone; anchor tuning is a dark art; not edge-device-friendly.</p><h3>Forward-Looking Trends</h3><p>Anchor-free RPNs, Swin/Transformer backbones, multi-scale tricks, plus brutal quantisation so the model runs on your phone. None are solved.</p><h3>Deep Dive for the Impatient Engineer 🛠️</h3><h3>From R-CNN → Fast → Faster</h3><ul><li><strong>2014 R-CNN:</strong> CNN on each cropped region (fixed Disk I/O + week-long training)</li><li><strong>2015 Fast R-CNN:</strong> Shared conv layers + RoI Pool (fixed external proposals still slow)</li><li><strong>2015 Faster R-CNN:</strong> Learned proposals with RPN (big speed win, one-GPU training)</li></ul><h3>Architecture in Four Bullets</h3><p><strong>1. Feature Extraction</strong><br>The input image passes through a backbone (ResNet-50, Swin-Tiny), yielding a rich C × H × W feature map.</p><p><strong>2. Region Proposal Network (RPN)</strong><br>A lightweight 3×3 conv layer slides over the feature map, branching into two heads: one predicts <em>objectness scores</em> for k anchors at each location, the other regresses box deltas. Top-N proposals (by score) advance.</p><p><strong>3. RoI Align</strong><br>Each proposal is projected back onto the feature map. RoI Align bilinearly samples and reshapes the region into a fixed 7 × 7 feature grid, avoiding quantisation misalignments.</p><p><strong>4. Detection Heads</strong><br>The pooled features feed two siblings: a softmax classifier (object vs background or specific class) and a Smooth L₁ box regressor that refines each proposal.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*NzlN-nz8OxtkJe8g.jpeg" /></figure><h3>2.3 Maths in a Nutshell</h3><p>Let an anchor box (A=(x_a,y_a,w_a,h_a)) and a ground truth box (G=(x,y,w,h)). Regression targets:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/419/0*hlZqu2G2rRLrfXzP" /></figure><p>Total loss for anchor <em>i</em>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/392/0*2heuqg8qvdFGRWQa" /></figure><p>where (p_i^*) is 1 for positive anchors, 0 otherwise, and (L_{}) is the Smooth (L_{1}) loss.</p><h3>Minimal, Copy-and-Run Code</h3><pre>from typing import List, Tuple<br>from PIL import Image<br>import torch<br>from torchvision import transforms<br>from torchvision.models.detection import fasterrcnn_resnet50_fpn<br>from torchvision.models.detection.rpn import AnchorGenerator<br><br>def build_anchor_generator() -&gt; AnchorGenerator:<br>    &quot;&quot;&quot;Create Faster R-CNN anchor generator&quot;&quot;&quot;<br>    return AnchorGenerator(<br>        sizes=((32, 64, 128, 256, 512),),<br>        aspect_ratios=((0.5, 1.0, 2.0),)<br>    )<br><br>def load_model() -&gt; torch.nn.Module:<br>    &quot;&quot;&quot;Load pretrained Faster R-CNN model&quot;&quot;&quot;<br>    model = fasterrcnn_resnet50_fpn(weights=&quot;DEFAULT&quot;)<br>    model.rpn.anchor_generator = build_anchor_generator()<br>    model.eval()<br>    return model<br><br>def predict(image_path: str) -&gt; List[Tuple[int, float]]:<br>    &quot;&quot;&quot;Get detected class and score pairs for an image&quot;&quot;&quot;<br>    model = load_model()<br>    image = Image.open(image_path).convert(&quot;RGB&quot;)<br>    tensor = transforms.ToTensor()(image)<br>    outputs = model([tensor])[0]<br>    return list(zip(outputs[&quot;labels&quot;].tolist(), outputs[&quot;scores&quot;].tolist()))<br><br>if __name__ == &quot;__main__&quot;:<br>    import sys<br>    img_path = sys.argv[1] if len(sys.argv) &gt; 1 else &quot;path/to/image.jpg&quot;<br>    predictions = predict(img_path)<br>    for class_id, score in predictions:<br>        print(f&quot;Class: {class_id}, Score: {score:.2f}&quot;)</pre><h3>Performance &amp; Variants</h3><ul><li><strong>Faster R-CNN + FPN:</strong> +6–8 mAP, –1 FPS (multi-scale features)</li><li><strong>Faster R-CNN-AF:</strong> ≈+1 mAP, +10 % FPS (anchor-free RPN)</li><li><strong>Cascade R-CNN:</strong> +3–4 mAP, –2 FPS (multi-stage IoU thresholds)</li></ul><h3>What Still Hurts</h3><p><em>Latency</em> &gt; 60 ms on edge chips, <em>anchor tuning hell</em> for weird aspect ratios, <em>domain shift</em> outside natural images, mediocre small-object recall unless you bolt on FPN or deformable convs.</p><h3>Research Horizons</h3><p><em>Unified anchor-free two-stage detectors</em>, <em>sparse dynamic convs</em> that prune RPN maps on-the-fly, and <em>self-supervised pre-training</em> for label-scarce industrial data. Faster R-CNN may be ten years old, but — as I argued in my <a href="https://medium.com/@sykoravojtech/quadratic-weighted-kappa-qwk-quick-overview-7073bf8c82a0">Quadratic Weighted Kappa primer</a> — solid maths plus pragmatic engineering keep classics alive. Expect the model to slim down and smarten up rather than bow out.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dd4fb798da9b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Quadratic Weighted Kappa (QWK): Quick Overview]]></title>
            <link>https://medium.com/@sykoravojtech/quadratic-weighted-kappa-qwk-quick-overview-7073bf8c82a0?source=rss-57a4d3efed9c------2</link>
            <guid isPermaLink="false">https://medium.com/p/7073bf8c82a0</guid>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[computer-vision]]></category>
            <dc:creator><![CDATA[Vojtěch Sýkora]]></dc:creator>
            <pubDate>Mon, 31 Mar 2025 17:08:18 GMT</pubDate>
            <atom:updated>2025-04-25T17:01:12.456Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/576/1*V6aEZHXcRj6rfpqWCyBTXA.png" /></figure><p>Let’s imagine we have a <strong>movie critic</strong> and their <strong>apprentice</strong>, and we want to see how well the apprentice can predict the critic’s movie ratings. We give them a rating scale:</p><ul><li><strong>0 — Terrible</strong></li><li><strong>1 — Bad</strong></li><li><strong>2 — Okay</strong></li><li><strong>3 — Good</strong></li><li><strong>4 — Amazing</strong></li></ul><p>Now comes the challenge: how do we score the apprentice’s predictions compared to the critic’s? We could use <strong>accuracy</strong>, meaning we only count the cases where the apprentice gets the exact same rating as the critic. But that feels a little unfair, doesn’t it?</p><p>Imagine the apprentice rates a movie as <strong>“Good” (3)</strong>, but the critic says it’s <strong>“Okay” (2)</strong>. That’s a small mistake — maybe the apprentice liked it just a bit more than the critic. Now compare that to a case where the apprentice says <strong>“Amazing” (4)</strong> while the critic says <strong>“Terrible” (0)</strong> — that’s a huge mistake! Yet, with simple accuracy, both of these mistakes are treated the same: <strong>completely wrong</strong>.</p><p>This is where <strong>Quadratic Weighted Kappa (QWK)</strong> comes in. It’s a way to measure agreement that gives more credit for being <strong>close to the right answer</strong> and penalizes big mistakes more heavily.</p><h3>How Does QWK Work?</h3><p>Think of QWK as a <strong>smart scoring system</strong>. It compares how well the apprentice’s ratings match the critic’s, but instead of a simple “right or wrong,” it considers <strong>how far off the apprentice’s guesses are</strong>. If they guess <strong>one rating off</strong>, it’s not as bad as guessing <strong>three ratings off</strong>.</p><p>To do this, QWK uses a weighting system:</p><ul><li>If the apprentice gives the <strong>exact same rating</strong> as the critic, <strong>that’s perfect agreement</strong>.</li><li>If the apprentice is <strong>one rating off</strong>, they still get partial credit.</li><li>If they are <strong>two ratings off</strong>, they lose more points.</li><li>If they are <strong>way off</strong>, they get almost no credit at all.</li></ul><p>By calculating the weighted agreement between the two raters and comparing it to what would happen if the apprentice was just <strong>guessing randomly</strong>, QWK gives a score between <strong>-1</strong> (worse than random), <strong>0</strong> (random guessing), and <strong>1</strong> (perfect agreement).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/0*tpFAddwld7gNJpn-.png" /></figure><h3>Why Use QWK Instead of Accuracy?</h3><p>Let’s say we have two apprentices:</p><ul><li><strong>Apprentice A</strong> makes a lot of small mistakes — usually just one rating off from the critic.</li><li><strong>Apprentice B</strong> gets some ratings exactly right, but when they’re wrong, they are <strong>way</strong> off.</li></ul><p>If we only used accuracy, we might think Apprentice B is better just because they got a few exact matches. But QWK recognizes that Apprentice A is more <strong>consistently close</strong> to the correct ratings, so they get a higher score. This makes QWK a much fairer way to measure performance, especially in situations like grading exams, medical diagnoses, and survey responses — anywhere where some mistakes are worse than others.</p><p>So next time you’re evaluating predictions on an <strong>ordinal scale</strong> (where categories have an order), don’t just count right vs. wrong — <strong>use Quadratic Weighted Kappa to measure how good the predictions really are!</strong></p><h3>Technical Deep Dive into Quadratic Weighted Kappa</h3><p>Alright mate, let’s lift the bonnet and see how Quadratic Weighted Kappa really ticks. Think of this as a friendly walkthrough — no need for fancy jargon without a simple explanation first.</p><h3>1. What’s what and why it matters</h3><p>Imagine you and a pal are rating the same set of items on a scale of 0 up to K−1 (for instance, movie ratings from 0 to 4). We call these <strong>ordinal</strong> categories because they follow an order — 0 is less than 1, 1 is less than 2, and so on.</p><ul><li>Let N be the total number of items you both rated.</li><li>Call your ratings A and your pal’s ratings B.</li></ul><p>We build a table O whose cell O_{ij} says “how many times you gave rating i and they gave rating j.”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/241/0*KbZltVEYk47-ZYLp" /></figure><p>Next, we decide how harshly to punish a mismatch. If you rate 0 and they rate 4, that’s worse than you rating 3 and they rate 4. Enter the <strong>weight matrix</strong> W:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/119/0*tUY3EsFTx-7J2I_W" /></figure><p>That number runs from 0 (no penalty when i=j) up to 1 (maximum penalty when i and j are at opposite ends).</p><h3>2. What we’d expect by chance</h3><p>If you and your pal rated independently, the chance you pick i and they pick j is just the product of your marginal shares. Let p_i be the fraction of times you chose i, and q_j the fraction for them:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/216/0*-jiS1VufiUzqhHhF" /></figure><p>Then the <strong>expected</strong> table E under independence is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/138/0*CCVvgFxjn3z5YvsL" /></figure><h3>3. Putting it all together</h3><ol><li><strong>Observed penalty</strong> = sum of W * O over all i,j</li><li><strong>Expected penalty</strong> = sum of W * E over all i,j</li><li><strong>QWK</strong> = 1 − (observed penalty ÷ expected penalty)</li></ol><p>In formula form:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/169/0*gM0EISH3vEXmslxa" /></figure><p>Here, κ_w = 1 means perfect agreement, κ_w = 0 is exactly chance, and κ_w can go below zero when agreement is worse than random.</p><h3>4. Practical tips and quirks</h3><ul><li><strong>Imbalance matters</strong>: If nearly everyone picks category 2, the expected penalty will also blow up, making κ_w small. You might want to rebalance or report per-category agreement too.</li><li><strong>Weight choices</strong>: Quadratic is great for ordered data, but you could use linear or custom weights if your problem calls for it.</li><li><strong>Links to Cohen’s kappa</strong>: If you replace w_{ij} with 1 whenever i≠j, you get the unweighted Cohen’s kappa. Linear weights give the linear-weighted kappa.</li><li><strong>Scales</strong>: Building the O table is O(N), everything else is O(K²) — tiny if your K is under 100. You can JIT-compile or run on GPU if you’re rating millions.</li></ul><h3>5. How to code it (NumPy style)</h3><pre>#!/usr/bin/env python3<br>import numpy as np<br>from numpy.typing import NDArray<br><br>def quadratic_weighted_kappa(<br>    ratings_a: NDArray[np.int64],<br>    ratings_b: NDArray[np.int64],<br>    num_categories: int | None = None,<br>) -&gt; float:<br>    &quot;&quot;&quot;Compute QWK for two rating arrays&quot;&quot;&quot;<br>    if ratings_a.shape != ratings_b.shape:<br>        raise ValueError(&quot;Ratings must have same shape&quot;)<br>    if num_categories is None:<br>        num_categories = int(max(ratings_a.max(), ratings_b.max()) + 1)<br>    if num_categories &lt;= 1:<br>        return 1.0<br><br>    obs = np.zeros((num_categories, num_categories), int)<br>    np.add.at(obs, (ratings_a, ratings_b), 1)<br><br>    idx = np.arange(num_categories)<br>    w = ((idx[:, None] - idx[None, :]) ** 2) / ((num_categories - 1) ** 2)<br><br>    row = obs.sum(axis=1, keepdims=True)<br>    col = obs.sum(axis=0, keepdims=True)<br>    exp = row @ col / obs.sum()<br><br>    num = np.einsum(&quot;ij,ij&quot;, w, obs)<br>    den = np.einsum(&quot;ij,ij&quot;, w, exp)<br><br>    if den == 0:<br>        return 1.0 if num == 0 else float(&#39;nan&#39;)<br><br>    return 1.0 - num / den<br><br><br>def main() -&gt; None:<br>    &quot;&quot;&quot;Run a simple example&quot;&quot;&quot;<br>    # sample ratings<br>    ratings_a = np.array([0, 1, 2, 3, 4, 2, 1], dtype=np.int64)<br>    ratings_b = np.array([0, 2, 2, 3, 4, 2, 0], dtype=np.int64)<br>    kappa = quadratic_weighted_kappa(ratings_a, ratings_b)<br>    print(f&quot;Quadratic Weighted Kappa: {kappa:.4f}&quot;)<br><br><br>if __name__ == &quot;__main__&quot;:<br>    main()</pre><p><strong>That’s it</strong> — once you’ve got this, QWK isn’t your bottleneck. Just gather good data, and let the maths do the rest.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7073bf8c82a0" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>