<?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 raditiasatriawan on Medium]]></title>
        <description><![CDATA[Stories by raditiasatriawan on Medium]]></description>
        <link>https://medium.com/@raditiaoffice?source=rss-7588b9157f35------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*3k4D3A02YkzLbhixB73RdQ.jpeg</url>
            <title>Stories by raditiasatriawan on Medium</title>
            <link>https://medium.com/@raditiaoffice?source=rss-7588b9157f35------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 21:26:48 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@raditiaoffice/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[Beyond Satellite Pixels: How Water Gates Safeguard Thailand’s Food Bowl]]></title>
            <link>https://medium.com/@raditiaoffice/beyond-satellite-pixels-how-water-gates-safeguard-thailands-food-bowl-cfa192f8320f?source=rss-7588b9157f35------2</link>
            <guid isPermaLink="false">https://medium.com/p/cfa192f8320f</guid>
            <category><![CDATA[geospatial]]></category>
            <category><![CDATA[food-security]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[thailand]]></category>
            <category><![CDATA[water-management]]></category>
            <dc:creator><![CDATA[raditiasatriawan]]></dc:creator>
            <pubDate>Thu, 19 Nov 2026 12:58:20 GMT</pubDate>
            <atom:updated>2026-11-19T12:58:20.297Z</atom:updated>
            <content:encoded><![CDATA[<h4>Lessons from a geospatial field trip across Nakhon Pathom, Samut Sakhon, and Samut Songkhram</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P10-kN0d_5W4QCB1Y8V76g.png" /></figure><p>As a Computer Science student interning at the KMUTT Geospatial Engineering and Innovation Center (KGEO) in Bangkok, most of my days are spent staring at satellite imagery, cleaning CSV datasets, and training machine learning models to predict flood risks. From a laptop screen, water looks like blue pixels, elevation looks like contour lines, and floods look like probability scores.</p><p>Recently, however, I stepped away from the code. Alongside my mentor, Ajarn Parivate (Ajarn Peri), and the KMUTT GIS class, I joined a full-day field trip across three vital provinces southwest of Bangkok: <strong>Nakhon Pathom, Samut Sakhon, and Samut Songkhram</strong>.</p><p>Our mission was to study water resource management and its direct link to <strong>food security. S</strong>pecifically looking at how river basins, canal networks, and water gates work together to address modern flooding challenges,including ongoing flood mitigation strategies in 2026. Seeing these systems operate in real life completely changed how I view the data I work with every day.</p><h3>The Geographic Lifeline: Between Two Rivers and the Sea</h3><p>To understand why water management here is so critical, you have to look at the geography. This region sits in a complex deltaic zone connecting the <strong>Mae Klong River</strong> and the <strong>Lower Tha Chin River</strong> before they empty into the Gulf of Thailand.</p><p>Linking these two major rivers is an intricate web of historic and engineered waterways — most notably the <strong>Damnoen Saduak Canal</strong>, <strong>Sunakhon Canal</strong>, and the <strong>Khlong Chinda network</strong>. While tourists often know Damnoen Saduak for its floating markets, to engineers and farmers, these canals are the circulatory system of central Thailand. They distribute freshwater inland while acting as drainage channels when heavy rains hit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*zn9IEVotHXKb9IsyCLvO9Q.png" /></figure><h3>Why Water Gates Matter: Protecting Thailand’s Food Bowl</h3><p>During our stops at various water gates and pumping stations, one overarching theme stood out: <strong>managing water here is synonymous with protecting the nation’s food supply.</strong></p><p>This tri-province corridor is one of Thailand’s richest agricultural and aquaculture hubs:</p><ul><li><strong>Nakhon Pathom</strong> thrives on high-value fruit orchards (especially its famous pomelos), vegetable farms,and rice paddies.</li><li><strong>Samut Sakhon</strong> is a powerhouse for coastal aquaculture, shrimp and fish farming, and seafood processing that feeds both Bangkok and international markets.</li><li><strong>Samut Songkhram</strong> relies on a delicate balance of freshwater and brackish ecosystems to sustain its coconut groves, lychee orchards, and coastal farms.</li></ul><p>Because this region is low-lying and borders the sea, it faces a relentless <strong>two-front threat</strong>:</p><ol><li><strong>Upstream Floods:</strong> Heavy seasonal rainfall and runoff flowing down from the northern and central basins can easily overwhelm rivers and submerge farmland.</li><li><strong>Downstream Saltwater Intrusion:</strong> High tides from the Gulf of Thailand constantly push seawater inland.If saline water seeps into irrigation canals, it destroys orchards and ruins crops for seasons to come.</li></ol><p><strong>Water gates act as the dynamic valves between these two forces.</strong> Rather than simply blocking water, operators adjust gate levels strategically (holding back saltwater during high tides, storing freshwater during dry spells, and opening sluices alongside pumping stations to flush excess floodwater out to sea when storms arrive).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i7iuisKAyaQtDDGKb5Q5rw.png" /></figure><h3>Navigating Today’s Climate Reality</h3><p>In the context of today’s shifting climate patterns (where intense rainfall events and prolonged dry spells are becoming harder to predict) static infrastructure is no longer enough. Studying the 2026 flood mitigation case in this basin made it clear that modern water management requires real-time coordination.</p><p>When upstream provinces experience heavy monsoon surges, water gates in Nakhon Pathom, Samut Sakhon, and Samut Songkhram have to absorb, divert, and discharge massive volumes of water without letting low-lying communities go underwater. At the same time, over-draining the canals leaves farmers vulnerable if dry weather follows. Every opening and closing of a gate is a calculated balancing act between <strong>disaster prevention</strong> and <strong>agricultural survival</strong>.</p><h3>The Human Element Behind the Engineering</h3><p>What impressed me most during the trip wasn’t just the concrete and steel of the water gates. It was the people.</p><p>Across every stop we made, it was inspiring to see local communities, farmers, and water management officials actively working together. Protecting these provinces from floods isn’t treated solely as a top-down government task; it is a shared effort where local knowledge meets civil engineering to keep neighborhoods safe and ensure the food supply chain remains unbroken even during severe weather.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2hGPgl2q3f-gHwwUsgzEzg.png" /></figure><h3>Reflections from a Computer Science Perspective</h3><p>Walking along the canal embankments gave me a fresh appreciation for my research back at KGEO. When we build flood prediction models or map land use from space, we are modeling the exact physical reality that these water gates manage every single day.</p><p>Remote sensing and machine learning can help forecast <em>when</em> and <em>where</em> water risks will rise (giving decision-makers valuable lead time) while physical infrastructure and dedicated local communities turn those insights into real-world protection. Bridging digital intelligence with on-the-ground engineering is where geospatial technology truly makes a difference.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cfa192f8320f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From R² = 0.19 to 0.80: Peeking Under the Hood of Satellite AI (Part 2)]]></title>
            <link>https://medium.com/@raditiaoffice/from-r%C2%B2-0-19-to-0-80-peeking-under-the-hood-of-satellite-ai-part-2-622f2db4868f?source=rss-7588b9157f35------2</link>
            <guid isPermaLink="false">https://medium.com/p/622f2db4868f</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[thailand]]></category>
            <category><![CDATA[mangrove]]></category>
            <category><![CDATA[estimations]]></category>
            <category><![CDATA[biomass]]></category>
            <dc:creator><![CDATA[raditiasatriawan]]></dc:creator>
            <pubDate>Sun, 15 Nov 2026 15:20:18 GMT</pubDate>
            <atom:updated>2026-11-15T15:20:18.704Z</atom:updated>
            <content:encoded><![CDATA[<h4>Deconstructing sensor saturation traps, discovering the cross-modal synergy between radar and red-edge optics, and exporting 10-meter biomass maps to QGIS.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*eIxuqnVOvyheoCQG" /><figcaption>Photo by <a href="https://unsplash.com/@imaginearth?utm_source=medium&amp;utm_medium=referral">ImaginEarth La Terre En Images</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Quick Recap from Part 1</h3><p>In <a href="https://medium.com/@raditiaoffice/from-r%C2%B2-0-19-abffaf6222ea?sharedUserId=raditiaoffice">Part 1 of this series</a>, we followed the initial turnaround of our mangrove biomass prediction pipeline along Southern Thailand’s Andaman coast:</p><ul><li>Our naive first baseline was a humbling flop (<strong>R² ≈ 0.19</strong>) due to temporal mismatches, coastal cloud haze, and uncalibrated ground-truth measurements.</li><li>By fixing the temporal baseline with 2024 annual median composites and calibrating our target data, our tri-feature baseline (<strong>VV + VH + NDVI</strong>) skyrocketed by nearly 400% to <strong>R² ≈ 0.78</strong> (RMSE ~407 kg) led by Extra Trees.</li></ul><p>On paper, the job seemed done. But as anyone who builds machine learning pipelines knows, a high score often conceals deeper questions: <strong>Was one sensor doing all the heavy lifting? Did we over-engineer? And was NDVI secretly going blind in dense old-growth canopies?</strong></p><p>To find out, we decided to deconstruct the entire system. Here is what we discovered under the hood.</p><h3>Act III: The Single-Sensor Surprise (3rd-Try, R² ≈ 0.26–0.32)</h3><p>To understand how much signal came from each individual satellite band, we stripped everything down to the bare metal. We trained our models using <strong>only one input feature at a time</strong>:</p><ul><li><strong>Sentinel-1 VV Backscatter Alone</strong> — <strong>Peak R² ≈ 0.32</strong> (RMSE ~699 kg)<br> <em>Best performer: Random Forest. Measures vertical surface and trunk interaction.</em></li><li><strong>Sentinel-2 NDVI Alone</strong> — <strong>Peak R² ≈ 0.28</strong> (RMSE ~740 kg)<br> <em>Best performer: LightGBM. Measures photosynthetic greenness.</em></li><li><strong>SeLI Leaf Area Index Alone</strong> — <strong>Peak R² ≈ 0.28</strong> (RMSE ~750 kg)<br> <em>Best performer: Extra Trees. Measures foliage area.</em></li><li><strong>Sentinel-1 VH Backscatter Alone</strong> — <strong>Peak R² ≈ 0.26</strong> (RMSE ~728 kg)<br> <em>Best performer: LightGBM. Measures canopy volume scattering.</em></li></ul><p>The result was an immediate eye-opener: <strong>No single satellite band could explain more than ~32% of mangrove biomass variation on its own.</strong></p><h3>Why Single Sensors Hit a Hard Ceiling</h3><p>The physics behind Earth observation explains this bottleneck:</p><ol><li><strong>The Optical Saturation Ceiling</strong>: Standard NDVI measures the contrast between Red (chlorophyll absorption) and Near-Infrared (leaf mesophyll reflection). In dense tropical mangroves where canopy cover routinely exceeds 80%, NDVI hits a ceiling around 0.85–0.90. At that point, a tree stand with 500 kg of wood and a mature giant holding 2,500 kg look virtually identical to the sensor.</li><li><strong>The Radar Moisture &amp; Speckle Noise</strong>: While C-band radar microwaves (5.4 GHz) can penetrate foliage, raw backscatter is intensely sensitive to ground moisture, tidal fluctuations, and speckle noise. Without optical canopy cues to anchor it, radar alone struggles to distinguish dense dry wood from wet muddy floor.</li></ol><p>Single sensors simply cannot see the whole picture.</p><h3>Act IV: The Secret Weapon — Red-Edge SeLI Leaf Area Index (4th-Try, Record R² ≈ 0.80)</h3><p>Knowing that NDVI was flattening out in mature stands, we looked for an optical feature capable of maintaining linear sensitivity in high-density canopies. We turned to Sentinel-2’s <strong>Red-Edge spectrum, </strong>specifically Band 5 (705 nm) and Narrow NIR Band 8A (865 nm).</p><p>We added <strong>LAI</strong> alongside our previous tri-feature set (VV, VH, NDVI), creating a 4-feature pipeline.</p><p>The benchmark response was electric:</p><ul><li><strong>Extra Trees Regressor</strong> — <strong>R² = 0.7971</strong> | RMSE: 407.11 kg <em>(All-time project record)</em></li><li><strong>Random Forest Regressor</strong> — <strong>R² = 0.7957</strong> | RMSE: 408.53 kg</li><li><strong>Gradient Boosting Regressor</strong> — <strong>R² = 0.7933</strong> | RMSE: 410.97 kg</li><li><strong>XGBoost Regressor</strong> — <strong>R² = 0.7865</strong> | RMSE: 417.65 kg</li><li><strong>LightGBM Regressor</strong> — <strong>R² = 0.7746</strong> | RMSE: 429.07 kg</li></ul><p>All five algorithms crossed into the <strong>R² ≈ 0.78–0.80</strong> territory.</p><p>More importantly, examining the residuals revealed that the largest estimation errors on heavy biomass plots (&gt;1,500 kg) had dropped significantly. Red-Edge LAI provided the exact high-density nuance that standard NDVI had missed.</p><h3>Act V: The 2-Input Ablation &amp; The Cross-Modal Synergy Law (5th-Try)</h3><p>This breakthrough raised another practical engineering question: <em>Do we really need four features, or can a minimalist 2-input pairing achieve comparable accuracy?</em></p><p>We systematically tested every pairwise combination of our four candidate features:</p><ul><li><strong>LAI + VV</strong> (Optical Foliage + SAR Co-Pol) — <strong>R² = 0.6927</strong> | RMSE: 501.05 kg <em>(Gradient Boosting)</em></li><li><strong>LAI + VH</strong> (Optical Foliage + SAR Volume) — <strong>R² = 0.6661</strong> | RMSE: 493.45 kg <em>(Extra Trees)</em></li><li><strong>NDVI + VH</strong> (Optical Greenness + SAR Volume) — <strong>R² = 0.6150</strong> | RMSE: 529.87 kg <em>(XGBoost)</em></li><li><strong>LAI + NDVI</strong> (Dual-Optical Only) — <strong>R² = 0.3594</strong> | RMSE: 683.52 kg <em>(Extra Trees)</em></li><li><strong>VV + VH</strong> (Dual-Polarization SAR Only) — <strong>R² = 0.3416</strong> | RMSE: 692.97 kg <em>(Extra Trees)</em></li></ul><p>This side-by-side comparison revealed an unmistakable pattern:</p><h3>The “1 + 1 = 3” Cross-Modal Multiplier</h3><p>Look at what happens when you compare intra-modal pairs (same sensor family) against cross-modal pairs (optical + radar):</p><pre>[Same Sensor Family]<br>• Dual-Optical (LAI + NDVI) : R² ≈ 0.36  (Only +0.08 above single NDVI)<br>• Dual-SAR     (VV + VH)    : R² ≈ 0.34  (Only +0.02 above single VV)<br>[Cross-Modal Pairs: Optical × Radar]<br>• Optical + Radar (LAI + VV): R² ≈ 0.69  (A MASSIVE +0.37 LEAP!)</pre><ol><li><strong>Strict Boundary Clipping</strong>: Using rasterio.mask, continuous biomass predictions were clipped strictly to provincial mangrove reserves.</li></ol><p>The resulting 10-meter GeoTIFF rasters open seamlessly in <strong>QGIS</strong>, rendering an unbroken landscape of biomass density: from low-biomass degraded fringes (0–300 kg/pixel) to massive old-growth mangrove cores exceeding 2,500 kg/pixel.</p><h3>Act VI: The 3-Input Showdown (6th-Try)</h3><p>Finally, we explored the middle ground: What happens when you test all possible tri-feature configurations?</p><ul><li><strong>NDVI + VV + VH</strong> (1 Opt + 2 SAR) — <strong>R² = 0.7608</strong> | RMSE: 442.02 kg <em>(Extra Trees)</em></li><li><strong>LAI + VV + VH</strong> (1 Opt + 2 SAR) — <strong>R² = 0.7607</strong> | RMSE: 442.18 kg <em>(Gradient Boosting)</em></li><li><strong>LAI + NDVI + VV</strong> (2 Opt + 1 SAR) — <strong>R² = 0.7274</strong> | RMSE: 471.89 kg <em>(Gradient Boosting)</em></li><li><strong>LAI + NDVI + VH</strong> (2 Opt + 1 SAR) — <strong>R² = 0.6776</strong> | RMSE: 484.94 kg <em>(Extra Trees)</em></li></ul><h3>The Rule: 2 Radar + 1 Optical Beats 2 Optical + 1 Radar</h3><p>The data told a very clear story:</p><ul><li>Configurations that included <strong>both radar polarizations (VV and VH)</strong> consistently scored <strong>R² ≥ 0.76</strong>.</li><li>Configurations with <strong>two optical indices and only one radar band</strong> dropped to <strong>0.67–0.72</strong>.</li></ul><p>Having both polarizations (VV for surface/trunk double-bounce and VH for cross-pol crown volume scattering) is vastly more informative for tree biomass than stacking multiple correlated optical indices.</p><h3>The Dimensional Scaling Law: When to Stop Adding Features</h3><p>Synthesizing all experimental rounds gives us a clean curve of feature dimensionality versus predictive accuracy:</p><ul><li><strong>Two complementary cross-modal features (LAI + VV)</strong> capture <strong>87%</strong> of the full model’s total predictive power.</li><li><strong>The 4-feature suite (VV, VH, NDVI, LAI)</strong> delivers peak accuracy (<strong>R² = 0.7971</strong>) and the lowest residual error (<strong>RMSE = 407.1 kg</strong>).</li><li>Adding further raw spectral channels beyond these four yields diminishing returns and increases the risk of overfitting.</li></ul><h3>From Python to GIS: Production Cartography in QGIS</h3><p>A high R² score in a Jupyter Notebook is useless if rangers and conservation analysts can’t interact with it on a map.</p><p>Using our trained <strong>4-Input Extra Trees model</strong>, we built an end-to-end spatial mapping pipeline:</p><ol><li><strong>Google Earth Engine Tile Retrieval</strong>: Exported Sentinel-1 and Sentinel-2 composites covering five mangrove-dense provinces in Southern Thailand: <strong>Krabi, Phang Nga, Ranong, Satun, and Trang</strong>.</li><li><strong>The Local Geometry Trick</strong>: In initial runs, GEE hung for minutes trying to download empty ocean tiles in the Andaman Sea. We fixed this by introducing a local Python geometry check using shapely.geometry.box:</li></ol><pre># Skip empty ocean tiles in 0.001s locally before calling GEE downloads<br>from shapely.geometry import box<br>import geopandas as gpd<br>province_geom = provinces_gdf.geometry.unary_union<br>for tile_bounds in grid_tiles:<br>    tile_box = box(*tile_bounds)<br>    if not tile_box.intersects(province_geom):<br>        continue # Instantly skips ocean tiles!</pre><ol><li><strong>Strict Boundary Clipping</strong>: Using rasterio.mask, continuous biomass predictions were clipped strictly to provincial mangrove reserves.</li></ol><p>The resulting 10-meter GeoTIFF rasters open seamlessly in <strong>QGIS</strong>, rendering an unbroken landscape of biomass density: from low-biomass degraded fringes (0–300 kg/pixel) to massive old-growth mangrove cores exceeding 2,500 kg/pixel.</p><h3>5 Practical Takeaways for Geospatial ML Engineers</h3><p>For anyone building machine learning models on satellite imagery, here are the core engineering lessons from this journey:</p><ol><li><strong>Physical Sensor Complementarity Trumps Feature Count</strong>: Don’t throw 15 optical indices into your model. Combine one optical index (pigment/canopy) with an active SAR microwave band (woody volume/structure) to capture true 3D vegetation form.</li><li><strong>Use Red-Edge Bands to Beat Canopy Saturation</strong>: Standard NDVI saturates quickly in dense tropical forests. Sentinel-2’s Red-Edge channels (B5 and B8A) retain linearity in high-biomass canopies where NDVI goes blind.</li><li><strong>Dual-Polarization SAR is Essential for Biomass</strong>: Having both co-polarization (VV: trunk and surface interaction) and cross-polarization (VH: volume scattering in branches) provides structural information that optical sensors cannot replicate.</li><li><strong>Tree Ensembles Are Built for Tabular Spatial Data</strong>: Extra Trees and Gradient Boosting consistently handled collinearity and extreme values on tabular pixel features without requiring complex data normalization.</li><li><strong>Ablation Studies Build Defensible Pipelines</strong>: Systematically testing 1-feature, 2-feature, 3-feature, and 4-feature setups gives you absolute confidence that every band in your pipeline is pulling its weight.</li></ol><h3>Conclusion &amp; Discussion</h3><p>Moving from <strong>R² = 0.19 to 0.80</strong> reinforced our belief that effective geospatial AI isn’t about deploying the most complex black-box model — it’s about respecting the underlying physics of Earth observation. By pairing C-band radar that penetrates forest canopies with red-edge optics that quantify leaf architecture, we can turn satellite constellations into precise planetary scales.</p><p>As global carbon markets demand higher verification standards for Blue Carbon, scalable and explainable satellite machine learning will be essential to protecting Earth’s coastal frontiers.</p><p><strong>How do you approach multi-sensor fusion in your remote sensing workflows? Have you run into similar saturation plateaus in other biomes?</strong></p><p><em>Let’s continue the conversation in the comments! If this series was helpful for your projects, please leave a few claps 👏, share it with your network, and feel free to connect!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=622f2db4868f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From R² = 0.19]]></title>
            <link>https://medium.com/@raditiaoffice/from-r%C2%B2-0-19-abffaf6222ea?source=rss-7588b9157f35------2</link>
            <guid isPermaLink="false">https://medium.com/p/abffaf6222ea</guid>
            <category><![CDATA[mangrove]]></category>
            <category><![CDATA[science]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[research]]></category>
            <category><![CDATA[biomass]]></category>
            <dc:creator><![CDATA[raditiasatriawan]]></dc:creator>
            <pubDate>Tue, 10 Nov 2026 05:58:28 GMT</pubDate>
            <atom:updated>2026-11-15T15:20:52.468Z</atom:updated>
            <content:encoded><![CDATA[<h3>From R² = 0.19 to 0.80: How We Mapped Mangrove Biomass Using Sentinel Satellites and Machine Learning</h3><h4>An engineer’s journey through sensor saturation traps, temporal mismatches, and the practical synergy between radar microwaves and optical satellite data.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*FrOlGk39-DXZZnmw" /><figcaption>Photo by <a href="https://unsplash.com/@ratna7674?utm_source=medium&amp;utm_medium=referral">Orpita Akther Ratna</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Quick Summary (TL;DR)</h3><ul><li><strong>The Challenge</strong>: Mangrove Above-Ground Biomass (AGB) is the cornerstone of coastal “Blue Carbon”, but manual in-situ field measurement is grueling, hazardous, and practically impossible across large regions due to waist-deep mud and sudden tidal surges.</li><li><strong>The Approach</strong>: Fusing free public satellite imagery from the European Space Agency (ESA) (<strong>Sentinel-1 C-band SAR</strong> and <strong>Sentinel-2 Multi-Spectral Optical) </strong>with five machine learning tree ensembles (Extra Trees, Random Forest, Gradient Boosting, XGBoost, and LightGBM).</li><li><strong>The Evolution</strong>: Across several iterative sprints, we turned an initial failure (<strong>R² ≈ 0.19</strong>) into a reliable spatial prediction pipeline reaching <strong>R² ≈ 0.80</strong> (RMSE ~407 kg) calibrated across 491 ground-truth plots in Southern Thailand.</li><li><strong>Key Engineering Takeaway</strong>: Pairing one optical feature with one radar feature boosts accuracy by <strong>+115%</strong> over single-sensor models, demonstrating that C-band radar penetrates canopy crowns to measure woody trunk structure while optical bands capture photosynthetic leaf activity.</li></ul><h3>Introduction: Why Mangroves, and Why Does AI Matter?</h3><p>Mangrove forests are among the most carbon-dense ecosystems on the planet. Often celebrated as <strong>Blue Carbon</strong> powerhouses, mangroves capture and store carbon at rates three to five times higher per hectare than terrestrial tropical rainforests. Most of this carbon is locked deep inside their dense root architectures, waterlogged sediments, and above-ground woody biomass.</p><p>Yet, estimating this biomass across large geographic scales presents a massive logistical hurdle.</p><p>If you have ever stepped foot in a coastal mangrove forest. you will know how brutal field surveys can be:</p><ul><li><strong>Waist-deep mud</strong> that suctions your boots with every single step.</li><li><strong>Tidal shifts</strong> that can completely submerge your field plots within a couple of hours.</li><li><strong>Impenetrable mazes</strong> of stilt roots (<em>Rhizophora spp.</em>) that defy standard forestry calipers and measuring tapes.</li></ul><p>Conducting tree-by-tree manual censuses across hundreds of thousands of hectares is simply not viable. Satellite Earth Observation paired with Machine Learning offers a practical, scalable alternative.</p><p>However, fusing satellite bands with machine learning is rarely as straightforward as downloading a GeoTIFF and calling model.fit().</p><p>This is the story of how our initial pipeline started with near-random guesses (<strong>R² ≈ 0.19</strong>) and evolved through hands-on debugging and feature engineering into a high-precision spatial mapping pipeline reaching <strong>R² ≈ 0.80</strong>.</p><h3>Act I: The Naive Baseline and What Went Wrong (1st-Try, R² ≈ 0.19)</h3><p>Like many early machine learning projects, our first attempt was overly optimistic: <em>“throw all available satellite bands into an ensemble and hope the trees figure out the patterns.”</em></p><p>We pulled Sentinel-1 dual-polarization SAR (VV, VH) and Sentinel-2 optical bands (B2, B3, B4, B8, NDVI) for January 2016, matched them to field coordinate points, and trained a standard Random Forest regressor.</p><p>The result was a sobering wake-up call:</p><ul><li><strong>R² = 0.1951</strong></li><li>The model had virtually zero predictive capability on unseen test sets.</li></ul><pre>=== 1st-Try Baseline Evaluation ===<br>Model          : Random Forest Regressor<br>R-squared (R²) : 0.1951<br>RMSE           : 15.38 kg (uncalibrated scale)</pre><h3>The Post-Mortem: Three Fatal Flaws</h3><p>A deep dive into our pipeline revealed three major issues:</p><ol><li><strong>Temporal Mismatch</strong>: The 2016 satellite snapshot was years apart from when the ground trees were actually inventoried. In dynamic coastal environments, mangrove stands had experienced growth, storm thinning, and tidal erosion in the intervening years.</li><li><strong>Coastal Cloud Contamination</strong>: Tropical coastlines are notorious for persistent cloud cover. Without robust cloud masking and temporal median filtering, our optical reflectance values were heavily contaminated by atmospheric haze.</li><li><strong>Uncalibrated Target Biomass</strong>: Raw plot weights lacked composite rank calibration and spatial normalization to match the 10-meter pixel resolution of the sensors.</li></ol><blockquote>“Before tuning hyperparameters or experimenting with fancy architectures, always verify the physical fidelity and alignment of your data.”</blockquote><h3>Act II: The Calibration Pivot and Tri-Feature Breakthrough (2nd-Try, R² ≈ 0.78)</h3><p>To fix these foundational flaws, we restructured the entire data architecture:</p><ul><li><strong>Target Calibration (</strong><strong>AGB_Revised_kg)</strong>: We implemented a standardized composite index ranking across 491 verified field tree inventory plots.</li><li><strong>Annual Median Cloud-Free Composites (2024)</strong>: Using Google Earth Engine (GEE), we built full-year median composites for both Sentinel-1 SAR (interferometric wide swath, dual-polarization) and Sentinel-2 (Level-2A surface reflectance with cloud probability filtering &lt;70%&lt;70\%&lt;70%).</li><li><strong>Tri-Feature Baseline</strong>: We stripped away redundant bands and retained three core variables: <strong>VV</strong> (SAR co-pol backscatter), <strong>VH</strong> (SAR cross-pol backscatter), and <strong>NDVI</strong> (Normalized Difference Vegetation Index).</li></ul><p>We set up a rigorous cross-validation framework evaluating five core machine learning algorithms across five test-split ratios (15% to 35%) using 5-fold cross-validation with RandomizedSearchCV(n_iter=15).</p><p>Here is how the five models performed across the benchmark:</p><ol><li><strong>Extra Trees Regressor</strong> — <strong>R² = 0.7828</strong> | RMSE: 407.83 kg<br> <em>(Our top performer at 20% test split, training in just 3.99s)</em></li><li><strong>Random Forest Regressor</strong> — <strong>R² = 0.7640</strong> | RMSE: 425.09 kg<br> <em>(Highly resilient and consistent across all validation splits)</em></li><li><strong>Gradient Boosting Regressor</strong> — <strong>R² = 0.7606</strong> | RMSE: 428.17 kg<br> <em>(Fast convergence with solid residual control in 3.00s)</em></li><li><strong>LightGBM Regressor</strong> — <strong>R² = 0.7594</strong> | RMSE: 429.25 kg<br> <em>(Lightweight and purpose-built for fast raster inference)</em></li><li><strong>XGBoost Regressor</strong> — <strong>R² = 0.7535</strong> | RMSE: 434.43 kg<br> <em>(Dependable baseline performance in 2.70s)</em></li></ol><p>The turnaround was immediate. In a single engineering sprint, our validation accuracy leaped from a dismal <strong>R² = 0.19</strong> to <strong>R² = 0.7828</strong> — an improvement of nearly <strong>400%</strong>.</p><p>All five algorithms consistently crossed the 0.75 threshold, with <strong>Extra Trees</strong> leading the pack. By fixing temporal alignment, filtering cloud noise, and calibrating the target values, the models finally had clean signals to learn from.</p><p>We celebrated. On paper, we had a working biomass prediction pipeline.</p><p><strong>But as anyone who builds machine learning systems knows, a high score often hides deeper questions.</strong></p><h3>The Reality Check: What Was the Model Actually Learning?</h3><p>Once the initial excitement settled down, a few practical doubts emerged that we couldn’t ignore:</p><ol><li><strong>Was one sensor doing all the heavy lifting?</strong> Was the model genuinely utilizing both radar and optical signals, or was it simply leaning on one and ignoring the other?</li><li><strong>Did we over-engineer the pipeline?</strong> Could a simpler setup achieve 90% of the result with half the pipeline complexity?</li><li><strong>The classic saturation trap</strong>: Anyone who works with NDVI knows it tends to flatten out once vegetation canopies get dense. Were our predictions secretly blind to the heaviest forest stands?</li></ol><p>Instead of calling it a day, we decided to treat this as an engineering puzzle and stress-test the entire setup.</p><p>What followed was an eye-opening experiment in feature dynamics — one that completely reshaped how we think about multi-modal satellite data and eventually pushed our benchmark past <strong>R² = 0.80</strong>.</p><h3>In Part 2: Peeking Under the Hood</h3><p>In <strong>Part 2</strong>, we explore the hands-on lessons learned from breaking down and stress-testing this pipeline:</p><ul><li><strong>The Single-Sensor Surprise (Act III)</strong>: What happens when you force models to rely on only one band at a time (and why single sensors hit an unexpected ceiling at R² ≈ 0.32).</li><li><strong>Beyond Standard Greenness (Act IV)</strong>: How swapping standard NDVI for Sentinel-2’s Red-Edge Leaf Area Index (SeLI LAI) unlocked our all-time record of <strong>R² = 0.7971</strong>.</li><li><strong>The Cross-Modal Synergy (Act V &amp; VI)</strong>: The physical reason why combining 1 Optical + 1 Radar feature triggers a +115% accuracy surge.</li><li><strong>From Python to GIS</strong>: Practical tips on turning model weights into clean, boundary-clipped raster maps in QGIS.</li></ul><p><strong>Continue reading:</strong><br> 👉 <a href="https://medium.com/@raditiaoffice/from-r%C2%B2-0-19-to-0-80-peeking-under-the-hood-of-satellite-ai-part-2-622f2db4868f?sharedUserId=raditiaoffice"><strong>Read Part 2: Peeking Under the Hood of Satellite AI →</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=abffaf6222ea" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Data Testing for LULC Classification in Chonburi, Thailand]]></title>
            <link>https://medium.com/@raditiaoffice/data-testing-for-lulc-classification-in-chonburi-thailand-c96ac21f7e2a?source=rss-7588b9157f35------2</link>
            <guid isPermaLink="false">https://medium.com/p/c96ac21f7e2a</guid>
            <category><![CDATA[google-earth-engine]]></category>
            <category><![CDATA[classification]]></category>
            <category><![CDATA[lulc]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[land-use-land-cover]]></category>
            <dc:creator><![CDATA[raditiasatriawan]]></dc:creator>
            <pubDate>Sat, 17 Aug 2024 22:54:45 GMT</pubDate>
            <atom:updated>2024-08-17T22:54:45.707Z</atom:updated>
            <content:encoded><![CDATA[<p>In a geospatial context, data testing for LULC Classification is a testing process with the provided latitude and longitude point, and with that point, it creates an area that needs to be classified by the model created by data training. In this case, the Google Earth Engine Python API needs to be used, and of course, another Python library that supports this testing such as rasterio to open tiff file, pandas, numpy, and also pickle to read the model.</p><p>Firstly, let’s choose a random point in Chonburi, Thailand by using the WEFGIS (<a href="https://wefgis-sync.com/">https://wefgis-sync.com</a>), and resulting in this random point [100.96392631530763,13.22024796436754].</p><p>Now, let’s process the data testing first. S2cloudless needs to be done first, to minimize the cloud that exists in the satellite image. In the WEFGIS, it noted that the condition in the map is in the year 2022, so the chosen start date will be 2022. But in this case, January from 1 to 31 will be chosen to get the testing data. By using the Google Earth Engine Python API, and the provided S2cloudless filtering process, the tiff data of the point with 100p of resolution is ready to be tested.</p><p>Next, is to calculate all of the used parameters by the model. In this case, it use NDVI, NDWI, NDBI, and BSI. Just calculate them all by using the provided formula for Copernicus S2_SR Satellite. Checking the parameters if all is in range is also indeed.</p><p>Now, the data is ready to be tested. Use pickle to read the model, convert the parameters into numpy, and predict the classes of each pixel by using the model that has been trained. And it should be completed.</p><p>If you read my previous medium story about LULC Classification in Chachoengsao, Thailand, there is still a little bit mistake. The result of the classification should be overlapping the original tiff file image, and mine is not. The problem is in the conversion process. The predicted data with predicted class, need to be converted from meter to latitude and longitude with correct conversion process. Now, it already fixed, and just saved the predicted data into GeoTIFF file, and everything should be done. Now use QGIS or any tool that you comfort with to open this GeoTIFF file, and it should be correct.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xzbv2QoWOOYJPquVQYbmeg.png" /><figcaption>Code to Export Predicted Class into GeoTIFF File</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JhZ5Pcv-CcSb4n0990IYSA.png" /><figcaption>Original GeoTIFF Testing Data</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iS2AaoZiSHyhotGq7LYG8g.png" /><figcaption>Classified GeoTIFF Data</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c96ac21f7e2a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Data Collecting and Training for LULC Classification in Chonburi, Thailand]]></title>
            <link>https://medium.com/@raditiaoffice/data-collecting-and-training-for-lulc-classification-in-chonburi-thailand-e4449e97decd?source=rss-7588b9157f35------2</link>
            <guid isPermaLink="false">https://medium.com/p/e4449e97decd</guid>
            <category><![CDATA[google-earth-engine]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[lulc]]></category>
            <category><![CDATA[classification]]></category>
            <category><![CDATA[land-use-land-cover]]></category>
            <dc:creator><![CDATA[raditiasatriawan]]></dc:creator>
            <pubDate>Sat, 17 Aug 2024 11:26:33 GMT</pubDate>
            <atom:updated>2024-08-17T11:26:33.753Z</atom:updated>
            <content:encoded><![CDATA[<p>It seems kind of interesting doing LULC Classification, even though this is just a starting point of further geospatial analysis, and of course integration with machine learning and the Internet of Things. This story of data collecting and training for LULC Classification in the Area of Interest (AOI) Chonburi, Thailand is a lot of fun and so much challenge. This LULC Classification provides 5 classes : <br>1. Bareland<br>2. Build Up<br>3. Forest<br>4. Grassland<br>5. Water</p><p>First, let’s talk about data collecting. The efficient and best way as this story is written, is collecting data with Google Earth Engine. A lot of people know that this platform is multifunctional. Rather be used for data collecting, data training, and even data testing. But for now, this platform is used for data collecting.</p><p>The AOI of Chonburi is a little bit challenging, because of the big area, and also a lot of clouds that exist and need to be filtered by using s2cloudless. These things make data collecting in Google Earth Engine take so much time to run and make it inefficient to perform full LULC Classification. Assume that a month of each class takes 10 minutes for collecting, and there are 5 classes with 12 months, so 5 x 12 x 10 = 600 Minutes of total data collecting, which equals 6 hours of data collecting only. That time does not include errors and internet lagging. Which will take a much longer time to continue to the next step.</p><p>Let’s skip that suffering parts hehe. Now, collect the data by looking at the ground truth of Chonburi, and point out the correct ground truth. From limited ground truth data, the points can be made to be efficient for data collecting and training. The amount of points that can be obtained: <br>1. Bareland (228 points)<br>2. Build Up (228 points)<br>3. Forest (231 points)<br>4. Grassland (223 points)<br>5. Water (260 points)<br>If those data were already correct and suitable for training data, now just export those points into CSV files, with different months of each file.</p><p>Now, we move on to the local Python environment, with Miniconda. Those exported CSV files, now need to be cleaned before training. If you already see my previous story, it is the same, but just with slightly different settings. First, merge all of the All of CSV files same classes in different months. So, there are only 5 CSV files just with different classes. After 5 of those CSV Files are OK, now move to calculation. 4 parameters that needed to be calculated are NDVI, NDWI, NDBI, and BSI. Just calculate the bands with the formula for finding those 4 parameter values. After that, it needs to be visualized to know what to do next.</p><p>In this case, after looking at the visualized 4 parameters, the data need to be outlined, to avoid data bias. Detailed outlined criteria are : <br>1. Bareland = If the BSI is under 0, it needs to be outlined.<br>2. Build Up = If the NDBI is under 0, it needs to be outlined.<br>3. Forest = If the NDVI is under 0, it needs to be outlined.<br>4. Grassland = If the NDVI is under 0, it needs to be outlined.<br>5. Water = If the NDWI is under 0, it needs to be outlined.</p><p>After outlined, the amount of data should changed. And now, the decision needs to be taken, either it must be downsampled, or upsampled. In this case, it will downsampled to 1625 points. Just a simple code to randomly choose those points to just 1625 points and all of the data is already the same amount.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/765/1*yDIqIsQankgN5FAKFH0-jw.png" /></figure><p>If all of the files are already downsampled, they now need to be merged into 1 big CSV file, that contains all of the data of each class. Just merge them by using pandas.</p><p>Now, time to train the model with the data. The kNN algorithm will now be used for training data. First, hyperparameter tuning needs to be done. After finding the best parameter, metric Minkowski, with 9 number of neighbors, and with p equals to 3. K-Fold Cross Validation can now be completed. With 10 splits, the K-Fold Cross Validation can be done. The model can get around 0.79 to 0.83 accuracy. That’s already a good accuracy. When checking for the average confusion matrix, the model can get a 0.8105853767897285 cv score. In this case, the model can now be saved for future testing.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e4449e97decd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Data Testing for LULC Classification of Chachoengsao, Thailand]]></title>
            <link>https://medium.com/@raditiaoffice/data-testing-for-lulc-classification-of-chachoengsao-thailand-224e2006cf96?source=rss-7588b9157f35------2</link>
            <guid isPermaLink="false">https://medium.com/p/224e2006cf96</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[lulc]]></category>
            <category><![CDATA[land-use-land-cover]]></category>
            <category><![CDATA[google-earth-engine]]></category>
            <category><![CDATA[classification]]></category>
            <dc:creator><![CDATA[raditiasatriawan]]></dc:creator>
            <pubDate>Thu, 15 Aug 2024 01:01:43 GMT</pubDate>
            <atom:updated>2024-08-15T01:01:43.967Z</atom:updated>
            <content:encoded><![CDATA[<p>If you read this writing, make sure you already read the data preparation and its training in my previous medium : <br><a href="https://medium.com/@raditiaoffice/data-training-for-lulc-of-chachoengsao-thailand-0d9ee0d839d0">https://medium.com/@raditiaoffice/data-training-for-lulc-of-chachoengsao-thailand-0d9ee0d839d0</a></p><p>The kNN model is already trained and is now ready to be tested. The testing is quite simple, is to test an area of a point that is inputted by the user. The random point can be selected using this website: <br><a href="https://wefgis-sync.com/">https://wefgis-sync.com/</a></p><p>The selected random point will be processed in the local Python environment. Just make the code for inputting latitude and longitude from the user. Now, Earth Engine API will be used. First, define the s2cloudless in the local Python environment, and use the user’s geometry point for the Area of Interest (AOI). Don’t forget to set the start date and end date. After all of the s2cloudless and its required information is prepared and run, now the GeoTIFF file from the AOI needs to be exported from the Google Earth engine API.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/598/1*Ml_Dur7fjEUme0yYbMF37A.png" /></figure><p>Next, working with the GeoTIFF file needs to be done. In this case, the Rasterio Python library is needed to perform this task. First, read the height and width from the GeoTIFF file, and read the band data from the width and height of the GeoTIFF file. As usual, calculate the NDVI, NDWI, and NDBI data, which are the parameters for 4 of the classes (Buildings, Water, Cropland, Woodland). And of course, select all of those 3 parameters.</p><p>Now, prediction with the model can be done. Use the saved model to predict the new data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/622/1*OaT5nlk9B15PC7aaDBaScw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/408/1*LSOrCbdx_q7HiHwXbXCIyQ.png" /></figure><p>After the predicted result is obtained, now simply just make the GeoTIFF file from the data, and make sure the conversion from the meters to latitude and longitude degrees is correct. Use the Rasterio Python Library with the EPSG 4326 for the CRS.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/884/1*gW0T49KXfCgepoXixkCE8w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*djLiKzVlTKFrJbNkKX9Ufw.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=224e2006cf96" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Data Training for LULC Classification of Chachoengsao, Thailand]]></title>
            <link>https://medium.com/@raditiaoffice/data-training-for-lulc-of-chachoengsao-thailand-0d9ee0d839d0?source=rss-7588b9157f35------2</link>
            <guid isPermaLink="false">https://medium.com/p/0d9ee0d839d0</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[lulc]]></category>
            <category><![CDATA[google-earth-engine]]></category>
            <category><![CDATA[land-use-land-cover]]></category>
            <category><![CDATA[classification]]></category>
            <dc:creator><![CDATA[raditiasatriawan]]></dc:creator>
            <pubDate>Wed, 14 Aug 2024 06:00:45 GMT</pubDate>
            <atom:updated>2024-08-14T13:59:34.296Z</atom:updated>
            <content:encoded><![CDATA[<p>The journey begins on 11/08/2024, with 16 hours straight of performing LULC Classification in Chachoengsao, Thailand. This activity aims to know land use and land cover in the Area of Interest (AOI) Chachoengsao.</p><p>This is the early LULC Classification, which only includes 4 classes that will be classified in the activity. Those are : <br>1. Buildings<br>2. Water<br>3. Cropland<br>4. Woodland<br>The ground truth data has already been obtained, and because it was taken in the year 2020, the LULC will be performed in the year 2020, from January to December.</p><p>The first thing that needed to be done, is data collecting. From the provided CSV ground truth files, import them to the Google Earth Engine. Then with the help of s2cloudless, point out all of the correct ground truth and make it to be feature collections. In this case, 200 points per class are needed for the training data.</p><p>After all of those feature collection points are obtained, export the points data to the CSV files. The export data is needed from January to December. Export all of those 4 classes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SSEUyWq_VUj2PkJzaT4SpA.png" /></figure><p>If all of the CSV data is already exported, download it to the local machine. Next, local data processing needs to be done. Visual Studio Code, Miniconda Environment, and Python will be needed in this process. All of the necessary libraries are just a basic library for machine learning, and data processing (ex. pandas, scikit-learn, numpy, matplotlib, etc). The additional library will be Earth Engine API and rasterio for opening GeoTIFF files.</p><p>After all of the needed data and tools are already prepared, next is merging all of the CSV files in each class. This can be done easily by using the pandas library, in Python. It will be resulting so much data in each class.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/852/1*h3XZdaTNd7YqL6l587mx6Q.png" /></figure><p>Next, all of the parameters need to be calculated. In this case, the parameters are only NDVI, NDWI, and NDBI. Calculate all of the bands with the formula to get the parameters value, in the context of the Sentinel 2 satellite.</p><p>Next is to visualize the data. If outlining the data is needed, then it needs to be done in purpose to clean the data from bias. Each class has different criteria, which data needs to be outlined, and which does not. In this case, outlining the data needs to be done, with the side effect of decreasing the amount of data that will be trained.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*26dS5jQxSjMqhkbYfmaejw.png" /></figure><p>After outlining all of the unnecessary data, next will be performed downsampling or upsampling. In this case, the downsampling will be performed, in order to correct imbalanced data and thereby improve model performance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/762/1*Yd7x2Hl9hjtTLtY1_VsReg.png" /></figure><p>And then merge all of the CSV class files into 1 CSV file, to perform kNN training data. Hyperparameter tuning needs to be done first to know which are the best parameters for the model.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/582/1*_uYSQrmBgFOPF4WgjBYWQA.png" /></figure><p>After searching for the best parameter, the result for the Best Parameters: {‘metric’: ‘minkowski’, ‘n_neighbors’: 5, ‘p’: 2}. Then just train the kNN with the best parameters.</p><p>Now, K-Fold Cross Validation needs to be done. Cross-validation is a statistical technique employed to assess the performance of machine learning models. It is widely utilized in practical machine learning to evaluate and choose the most suitable model for a specific predictive task. This is due to its straightforward nature, ease of implementation, and ability to produce skill estimates with typically lower bias compared to other methods.</p><p>Finding the average confusion matrix score is needs to be done also, to know the performance of the trained model.</p><p>If all of the scores looks perfectly fine, then just save the model for future training.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0d9ee0d839d0" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>