<?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 Ignacio Perez Lagleyze on Medium]]></title>
        <description><![CDATA[Stories by Ignacio Perez Lagleyze on Medium]]></description>
        <link>https://medium.com/@ignacioperezlagleyze?source=rss-457da334d29------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*_Dwj3-2yHvXSs-ce</url>
            <title>Stories by Ignacio Perez Lagleyze on Medium</title>
            <link>https://medium.com/@ignacioperezlagleyze?source=rss-457da334d29------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 23:27:38 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ignacioperezlagleyze/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[Bioacoustics in honeybee hives: a queen-loss detection model, fact or artifact?]]></title>
            <link>https://medium.com/@ignacioperezlagleyze/bioacoustics-in-honeybee-hives-a-queen-loss-detection-model-fact-or-artifact-25b7288e9b26?source=rss-457da334d29------2</link>
            <guid isPermaLink="false">https://medium.com/p/25b7288e9b26</guid>
            <category><![CDATA[beekeeping]]></category>
            <category><![CDATA[predictive-modeling]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[bees]]></category>
            <dc:creator><![CDATA[Ignacio Perez Lagleyze]]></dc:creator>
            <pubDate>Sat, 03 Oct 2026 20:11:52 GMT</pubDate>
            <atom:updated>2026-10-03T20:11:52.307Z</atom:updated>
            <content:encoded><![CDATA[<h4><em>about bees, bioacoustic predictive models, and why a perfect result in biology is a red flag</em></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RbrQmTAZULPElbPpeeFtJA.jpeg" /><figcaption>Our training apiary, courtesy of De Feudis beekeeper family, located in Mar del Plata, Buenos Aires, Argentina.</figcaption></figure><p>Can you tell if a beehive has lost its queen just by listening?</p><p>One way honey bees communicate is through vibrations, which we perceive as sounds. A queenless colony changes its behavior, and there are good reasons to believe it also “sounds” different. Even an experienced beekeeper can tell by its sound if something is wrong. If we could detect it with a microphone, the beekeeper would be spared from having to open the hive to check — and opening a hive isn’t free: it stresses the colony, cools the nest, and interrupts their work. Remote and non-invasive monitoring would be a real game changer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*B10gR2p-NP9QFozSJVPHzA.jpeg" /><figcaption>One of our testing hives. The act of opening and handling it alters the hive and causes it to cool — more or less rapidly, depending on the external temperature. That is stressful.</figcaption></figure><p>We trained two models to give it a try. And what happened next is way more interesting than if it had just worked on the first try.</p><ol><li><strong>Two paths, two models</strong></li></ol><p>The first one uses VGGish, a neural network pre-trained by Google on millions of sounds of all kinds. The idea is to take advantage of the fact that it already “knows how to listen” in general, and just teach it to distinguish our specific case.</p><p>The second one is more handmade: it converts each audio fragment into a spectrogram — a sort of photograph of the sound, showing which frequencies are playing and how loud — and trains a convolutional neural network to classify those images.</p><p>They share almost nothing: different audio representations, architectures and ways of looking at the problem. Both were trained on our own recordings from an apiary in Mar del Plata, Argentina, dedicated to breeding queens, so we knew for certain which hives had a queen and which didn’t.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/887/1*trvm32gqkRE9RnSsi5xBQg.jpeg" /><figcaption>One of our devices. There are other sensors in addition to microphone, like temperature, weight and humidity. But those are for another story.</figcaption></figure><p>Within the same apiary, both models performed well. But that, as we were about to learn, means a lot less than it seems.</p><p><strong>2. The crucial step: generalizing to remote apiaries</strong></p><p>This step in bee bioacoustics seems much less explored, and we decided to tackle it.</p><p>Most studies train and evaluate their models on hives from the same apiary, or even the exact same hives. The model learns, it’s tested, it performs well, it gets published. But did the model actually <em>learn</em>, or did it just <em>memorize</em>? These models usually fail when used on new hives, with a different microphone, in a different place. In the field, there are too many variables to consider.</p><p>So, we went looking for outside data. We found UrBAN, a public dataset of hive recordings from a rooftop in Montreal, featuring nine hives monitored over two years alongside the beekeeper’s field notes: which day each hive was checked, whether it had a queen, if it was queenless, its general state, feeding, etc.</p><p>We cross-referenced those notes with the recordings and put together a test set: 54 fifteen-minute recordings from a single hive, 20 during a documented queenless period, and 34 with a queen. Our models had never heard this hive, this microphone, or this environment before. Don’t be fooled; 810 minutes of bee audio might not be enough for a <em>Nature </em>paper but it’s quite a lot.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JZkg1NWytfQwzGfOy8ksHQ.png" /></figure><p><strong>3. The suspicious result</strong></p><p>The first model separated the two groups with an AUC of 0.99.</p><p>AUC measures something simple: if you grab a random queenless recording and a queen-right recording, does the model assign a higher “suspicion of being queenless” to the correct one? A 0.5 is a coin flip. A 1 is getting it right every single time. 0.99 is practically perfect.</p><p>Excellent… right?</p><p>Except that, at the same time, the model misclassified almost everything. It claimed all 54 recordings were from queenless hives. Every single one. Including the 34 that actually had a queen.</p><p>How can both things be true at once? This seems like a contradiction, but it isn’t. They are two different questions.</p><p>The model doesn’t just say “with queen” or “queenless” outright; it outputs a number between 0 and 1 — its level of suspicion. Then there’s a cutoff line — usually 0.5 by convention — and whatever falls above that line gets labeled as queenless.</p><p>When we looked at the raw numbers, the recordings with a queen were getting values between 0.74 and 0.97. The ones without a queen, between 0.95 and 0.99. Two well-separated groups (Fig. 1), but both entirely above 0.5. With the cutoff line in its usual spot, everything fell on the same side.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a9Bf_8mj4atH-TyaYsCx_Q.png" /><figcaption>Fig. 1. Balanced accuracy vs ROC-AUC: another perspective of the same data can reveal natural phenomena.</figcaption></figure><p>Think of it like an uncalibrated thermometer that reads five degrees too hot. If you test it on ten people, it will still show higher temps for the sick ones than the healthy ones: the thermometer works, it sorts them correctly. But if you use the standard threshold for a fever, it will tell you everyone is sick.</p><p>We can think of our model as that thermometer. It learned something real about the sound of a queenless hive, and that “something” survived the move to a new apiary. What didn’t survive was the calibration: the cutoff point, fine-tuned on our own hives, got shifted when applied to someone else’s.</p><p>That alone is a useful finding, with a practical takeaway: a model that “fails” when moving to a new apiary might actually be working perfectly and just need calibration.</p><p>Then we ran the second model, the spectrogram one. It scored an AUC of 1. The exact same pattern, the same shifted calibration.</p><p><strong>4. So, is the model actually predicting queenlessness?</strong></p><p>Two models with nothing in common, agreeing on a nearly perfect separation. It could easily be read as double confirmation.</p><p>But in biology, when something works <em>too</em> well, the most likely explanation is that it’s a mistake. It usually means there’s something in the data making the problem trivially easy.</p><p>So we took another look at the dates.</p><p>For that particular hive, the queenless recordings were from June 2nd to June 4th. The recordings with a queen were from June 14th onwards. Both models could simply be separating, with surgical precision, “early June” from “mid-June” — and not the presence of a queen (Fig. 2).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZL9TXEMeqsjpRUqwEuycCg.png" /><figcaption>Fig. 2. The same two clusters are separated by calendar date and by model score alike — the data cannot tell which one the model is using.</figcaption></figure><p>Furthermore, the field notes mentioned that hive splits had been performed during that queenless window. Meaning that during those days, the colony wasn’t just queenless; it had also been recently manipulated, had fewer bees, and was agitated.</p><p>There’s no way, with this data, to untangle those three things. The most honest thing we can say is: two independent models detect an acoustic signature that distinguishes one period from another, and the absence of a queen is the most plausible biological explanation — but not the only possible one.</p><p>A brief disclaimer: we are aware of certain limitations — such as the fact that more robust results would have been obtained if we had tested a few hives simultaneously under different conditions and, of course, the sample size (“n”) — ; nevertheless, some results remain interesting: two models — one with a traditional architecture and the ther with a new one — converge when using the same dataset; and, regardless of which biological explanation holds, the models succeed in detecting distinct behavior, and could be very useful.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=25b7288e9b26" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>