<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Data Science on Volundarhus</title><link>http://www.volundarhus.com/categories/data-science/</link><description>Recent content in Data Science on Volundarhus</description><generator>Hugo</generator><language>en-US</language><lastBuildDate>Sun, 29 Nov 2026 00:00:00 +0000</lastBuildDate><atom:link href="http://www.volundarhus.com/categories/data-science/index.xml" rel="self" type="application/rss+xml"/><item><title>Small-Data MLOps: Fresh, Warm, and Greedy Hyperparameter Optimization</title><link>http://www.volundarhus.com/posts/small_data_hpo/</link><pubDate>Sun, 29 Nov 2026 00:00:00 +0000</pubDate><guid>http://www.volundarhus.com/posts/small_data_hpo/</guid><description>&lt;p&gt;&lt;a href="https://github.com/huntermills707/small_ml_hpo" class="external-link" target="_blank" rel="noopener"&gt;GitHub Repo&lt;/a&gt;&lt;/p&gt;&#10;&lt;h2 id="the-model-is-small-the-refresh-policy-is-still-interesting"&gt;&#10; The model is small; the refresh policy is still interesting&#10; &lt;a class="heading-link" href="#the-model-is-small-the-refresh-policy-is-still-interesting"&gt;&#10; &lt;i class="fa-solid fa-link" aria-hidden="true" title="Link to heading"&gt;&lt;/i&gt;&#10; &lt;span class="sr-only"&gt;Link to heading&lt;/span&gt;&#10; &lt;/a&gt;&#10;&lt;/h2&gt;&#10;&lt;p&gt;A lot of hyperparameter optimization examples stop after one search. They find a good configuration, save the model, and leave the next training run as an exercise for the reader. Production systems have to answer a harder question: when new data arrives, how much of that search should happen again?&lt;/p&gt;</description></item><item><title>A Full-Loop MLOps Platform on Two Homelab Kubernetes Clusters</title><link>http://www.volundarhus.com/posts/basic_mlops_pipeline/</link><pubDate>Mon, 20 Jul 2026 18:46:00 -0700</pubDate><guid>http://www.volundarhus.com/posts/basic_mlops_pipeline/</guid><description>&lt;p&gt;&lt;a href="https://github.com/huntermills707/haterade" class="external-link" target="_blank" rel="noopener"&gt;GitHub Repo&lt;/a&gt;&lt;/p&gt;&#10;&lt;h2 id="why-i-built-this"&gt;&#10; Why I built this&#10; &lt;a class="heading-link" href="#why-i-built-this"&gt;&#10; &lt;i class="fa-solid fa-link" aria-hidden="true" title="Link to heading"&gt;&lt;/i&gt;&#10; &lt;span class="sr-only"&gt;Link to heading&lt;/span&gt;&#10; &lt;/a&gt;&#10;&lt;/h2&gt;&#10;&lt;p&gt;Most MLOps tutorials stop at &amp;ldquo;model in a notebook, Dockerfile around it.&amp;rdquo; The hard part is everything after: how a trained artifact moves from a training run into a production-grade serving topology, how a new model version earns its way into production, and what it costs to serve. I wanted that whole path to be concrete and reproducible on hardware I own, so I built it: a text-toxicity classifier that goes train → register → export → serve → canary → promote (or roll back), with a feedback loop that routes user corrections back into training data.&lt;/p&gt;</description></item><item><title>pymargins: A Ground-Up Redesign of Marginal Effects for Python</title><link>http://www.volundarhus.com/posts/pymargins_package/</link><pubDate>Sun, 31 May 2026 00:00:00 +0000</pubDate><guid>http://www.volundarhus.com/posts/pymargins_package/</guid><description>&lt;p&gt;A while back I wrote about &lt;a href="http://www.volundarhus.com/posts/smmargins/" &gt;marginal effects for StatsModels&lt;/a&gt;&#10;and then &lt;a href="http://www.volundarhus.com/posts/smmargins_package/" &gt;released that work as &lt;strong&gt;smmargins&lt;/strong&gt;&lt;/a&gt;,&#10;a package that brought Stata-style &lt;code&gt;margins&lt;/code&gt; to the StatsModels&#10;ecosystem. This post is about its successor, &lt;strong&gt;pymargins&lt;/strong&gt;, which is&#10;not a new version of smmargins but a complete, ground-up redesign.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#d8dee9;background-color:#2e3440;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;pip install pymargins&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="where-this-came-from"&gt;&#10; Where this came from&#10; &lt;a class="heading-link" href="#where-this-came-from"&gt;&#10; &lt;i class="fa-solid fa-link" aria-hidden="true" title="Link to heading"&gt;&lt;/i&gt;&#10; &lt;span class="sr-only"&gt;Link to heading&lt;/span&gt;&#10; &lt;/a&gt;&#10;&lt;/h2&gt;&#10;&lt;p&gt;smmargins started as research code. I was doing population-study work&#10;at UCSF, and the recurring need was to turn fitted models into&#10;quantities people could actually act on: a risk difference in&#10;percentage points, an adjusted prediction at a representative patient&#10;profile, a subgroup average marginal effect. StatsModels'&#10;&lt;code&gt;get_margeff()&lt;/code&gt; covered a sliver of that, so I kept accreting helpers&#10;until the helpers were the size of a package. smmargins was me carving&#10;the useful parts out of that research code and giving them a public&#10;API.&lt;/p&gt;</description></item><item><title>Introducing smmargins: Stata-Style Margins for Python StatsModels</title><link>http://www.volundarhus.com/posts/smmargins_package/</link><pubDate>Sun, 03 May 2026 21:46:31 -0700</pubDate><guid>http://www.volundarhus.com/posts/smmargins_package/</guid><description>A new Python package bringing Stata&amp;rsquo;s margins command to the StatsModels ecosystem.</description></item><item><title>Marginal Effects for StatsModels: A Stata-style `margins` in Python</title><link>http://www.volundarhus.com/posts/smmargins/</link><pubDate>Wed, 22 Apr 2026 00:00:00 +0000</pubDate><guid>http://www.volundarhus.com/posts/smmargins/</guid><description>&lt;blockquote&gt;&#10;&lt;p&gt;&lt;strong&gt;Archived.&lt;/strong&gt; The module described here grew into the &lt;strong&gt;smmargins&lt;/strong&gt;&#10;package, which has since been superseded by &lt;strong&gt;pymargins&lt;/strong&gt;, a&#10;ground-up redesign with JAX-native autodiff, a κ curvature diagnostic,&#10;unified delta/simulation/bootstrap inference, and many more model&#10;backends. The write-up below is kept for the math and design notes,&#10;but new development happens on pymargins. See &lt;a href="http://www.volundarhus.com/posts/pymargins_package/" &gt;pymargins: A Ground-Up&#10;Redesign of Marginal Effects for Python&lt;/a&gt;.&lt;/p&gt;&#10;&lt;/blockquote&gt;&#10;&lt;p&gt;If you&amp;rsquo;ve ever moved from Stata to Python and reached for &lt;code&gt;margins, dydx(*) at(age=(25 45 65))&lt;/code&gt;, you know the feeling. StatsModels has &lt;code&gt;get_margeff&lt;/code&gt;, but it&amp;rsquo;s narrow: average or at-means, continuous variables, a couple of model classes. The moment you want a marginal effect &lt;em&gt;at a specific covariate profile&lt;/em&gt;, or a discrete change for a factor, or a difference-in-differences on the probability scale of a logit, you&amp;rsquo;re on your own.&lt;/p&gt;</description></item><item><title>Stratified Word Embeddings with Patient and Provider Metadata</title><link>http://www.volundarhus.com/posts/fast_text_context/</link><pubDate>Sun, 05 Apr 2026 19:52:47 -0700</pubDate><guid>http://www.volundarhus.com/posts/fast_text_context/</guid><description>&lt;p&gt;Standard word embeddings treat every occurrence of a word as equivalent. &amp;ldquo;Chest pain&amp;rdquo; means the same thing whether it appears in a note written by an emergency attending about an 80-year-old Medicare patient or by a resident describing an elective pre-op. That homogeneity is a fundamental design choice in Word2Vec and FastText, and for most downstream tasks it is a reasonable one. Clinical NLP, however, operates in a domain where who is speaking, about whom, and in what care setting are inseparable from meaning. This post describes &lt;strong&gt;FastTextContext&lt;/strong&gt;, a from-scratch C++ implementation that extends FastText&amp;rsquo;s skip-gram model with learned metadata embeddings for patient demographics and provider role, fused through a shared projection matrix.&lt;/p&gt;</description></item><item><title>Visualizing Social Determinants of Health at the County Level</title><link>http://www.volundarhus.com/posts/pdi_visualizer/</link><pubDate>Mon, 23 Feb 2026 17:34:46 -0800</pubDate><guid>http://www.volundarhus.com/posts/pdi_visualizer/</guid><description>&lt;p&gt;Social determinants of health (SDoH) shape outcomes just as much as clinical care, but most public-health data is hard to grok as a table or a static chart. The granular patterns that drive disparities get lost. I recently built a Plotly/Dash visualizer for the Principled Deprivation Index that lets anyone explore a suite of deprivation indexes alongside CDC-reported condition rates, all mapped to U.S. counties.&lt;/p&gt;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&lt;a class="app-demo" href="https://pdi-visualizer.onrender.com/" target="_blank" rel="noopener"&gt;&#10; &#10; &lt;img class="app-demo-logo" src="http://www.volundarhus.com/images/render.svg" alt="Render"&gt;&#10; &#10; &lt;span class="app-demo-text"&gt;&#10; &lt;strong&gt;PDI Visualizer live demo&lt;/strong&gt;&#10; &lt;span&gt;Explore county deprivation indexes and health outcomes on Render&lt;/span&gt;&#10; &lt;/span&gt;&#10; &lt;i class="fa-solid fa-arrow-up-right-from-square" aria-hidden="true"&gt;&lt;/i&gt;&#10; &lt;span class="sr-only"&gt;(opens in a new tab)&lt;/span&gt;&#10;&lt;/a&gt;&#10;&#10;&lt;p&gt;&lt;img src="preview.png" alt="Preview"&gt;&lt;/p&gt;</description></item><item><title>Updating Plotly’s Choropleth Example with Current US Census Data</title><link>http://www.volundarhus.com/posts/geojson_plotly/</link><pubDate>Sat, 21 Feb 2026 19:44:23 -0800</pubDate><guid>http://www.volundarhus.com/posts/geojson_plotly/</guid><description>&lt;h2 id="introduction"&gt;&#10; Introduction&#10; &lt;a class="heading-link" href="#introduction"&gt;&#10; &lt;i class="fa-solid fa-link" aria-hidden="true" title="Link to heading"&gt;&lt;/i&gt;&#10; &lt;span class="sr-only"&gt;Link to heading&lt;/span&gt;&#10; &lt;/a&gt;&#10;&lt;/h2&gt;&#10;&lt;p&gt;Plotly/Dash makes it easy to build interactive dashboards, and its choropleth maps are a great way to visualize geographic data. Unfortunately, the &lt;a href="https://plotly.com/python/choropleth-maps/#choropleth-map-using-geojson" class="external-link" target="_blank" rel="noopener"&gt;official example&lt;/a&gt; uses outdated unemployment data and an old GeoJSON file. Since U.S. county boundaries change over time, those IDs no longer line up with the latest Census data.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="plotly_choropleth.png" alt="Choropleth"&gt;&lt;/p&gt;&#10;&lt;p&gt;In this post I’ll show how to replace the stale assets with fresh data pulled directly from the U.S. Census Bureau.&lt;/p&gt;</description></item><item><title>Principled Deprivation Index – A Julia-Powered, GLRM-Based Social Metric</title><link>http://www.volundarhus.com/posts/pdi_init/</link><pubDate>Mon, 16 Feb 2026 18:16:38 -0800</pubDate><guid>http://www.volundarhus.com/posts/pdi_init/</guid><description>&lt;h2 id="why-build-a-new-deprivation-index"&gt;&#10; Why Build a New Deprivation Index?&#10; &lt;a class="heading-link" href="#why-build-a-new-deprivation-index"&gt;&#10; &lt;i class="fa-solid fa-link" aria-hidden="true" title="Link to heading"&gt;&lt;/i&gt;&#10; &lt;span class="sr-only"&gt;Link to heading&lt;/span&gt;&#10; &lt;/a&gt;&#10;&lt;/h2&gt;&#10;&lt;p&gt;Most existing socioeconomic measures (ADI, NDI, SVI) rely on PCA-style factor analysis. That approach forces you to fill every missing cell with a crude average and produces “centered” scores that hide the real magnitude of deprivation. The specific problems:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;Missing data gets mean-imputed&lt;/strong&gt;, which distorts local realities. It also assumes data is missing at random, which is often false. Rural areas have greater missingness.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Outliers dominate the factor space&lt;/strong&gt;, pulling the whole index in the wrong direction.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Interpretability is a nightmare&lt;/strong&gt;. The leading component mixes positive and negative loadings, making it impossible to explain to policymakers.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;I needed a metric that actually reflects deprivation, tolerates gaps, and stays robust when a few extreme observations appear. The answer is a Generalized Low Rank Model (GLRM) with carefully chosen constraints.&lt;/p&gt;</description></item></channel></rss>