<?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 Devon Sampson on Medium]]></title>
        <description><![CDATA[Stories by Devon Sampson on Medium]]></description>
        <link>https://medium.com/@devonds?source=rss-454fc4c77eaa------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*SalLOFc6pSzZ-N-Td1pXkw.jpeg</url>
            <title>Stories by Devon Sampson on Medium</title>
            <link>https://medium.com/@devonds?source=rss-454fc4c77eaa------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 21:34:04 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@devonds/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[Photon]]></title>
            <link>https://medium.com/@devonds/photon-efac5b5495d9?source=rss-454fc4c77eaa------2</link>
            <guid isPermaLink="false">https://medium.com/p/efac5b5495d9</guid>
            <category><![CDATA[covid19]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[data-visualization]]></category>
            <dc:creator><![CDATA[Devon Sampson]]></dc:creator>
            <pubDate>Wed, 19 Aug 2020 21:49:06 GMT</pubDate>
            <atom:updated>2022-11-16T19:09:28.273Z</atom:updated>
            <content:encoded><![CDATA[<h3>Automatically visualize patient and virus data for personalized COVID-19 care</h3><blockquote>Photon is a model for predicting design decisions data visualizations from an arbitraty tabular dataset. I built it as <a href="https://insightfellows.com/data-science">Data Science Fellow at Insight</a>, consulting for the Seattle-based bioinformatics company <a href="https://omic.ai/">Omic</a>.</blockquote><h3>Automatic data visualization</h3><p>I have done a lot of data visualization. For the past six years, I have run a research consulting company, and actionable data visualizations are almost always a key deliverable for any project. There a is a lot of creativity in data visualization, but there is also a lot of repetative work. Each visualization requires a routine set of decisions — like what type of chart best represents the data? What do I put on the x axis? What do I put on the y axis? Do I need to transform the scale of the data? I think we can automate some of this process.</p><p>And as an Insight Data Science Fellow, I consulted for Omic, a health data startup with the most compelling application for automated data visualization: providing clinicians with relivant and actionable data visualizations to inform personalized COVID-19 care.</p><p>We know that some factors — age, comorbidities — are behind what makes some COVID-19 patients have life-thretening sympotoms, while others have very mild symptoms or none at all. But even patients that look similar in their demographics and medical history can manifest very different cases. Researchers are only beginning to undersand the factors behind case severity.</p><p>There is growing evidence that genetics affect the course of COVID cases — the genetics of the patient, and the specific virus strain that the patient has. Digging into genomic data is labor-intensive, and automating the process of surfacing relivant and actionable aspects of this data could help clinicians make care decisions.</p><p>Omic has a powerful tool that allows clinicians and researchers to search for medical outcomes across thousands of clinical trials. A clinician could enter a question specific to their COVID-19 patient, for example, and the algorithm would provide data on health outcomes for similar patients. Omic wanted to improve their model that automatically creates relevant visualizations from whatever tabular data that their algorithm returns, so that rather than seeing a table of data, the clinician sees a compelling, informative data vizualization.</p><p>The company’s first model chose from six chart types with about 40% accuracy, which is significantly better than random, but in practice meant that most of the time the tool would default to displaying tables of raw data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VGqnHr22yz6j0vF9qoTemQ.png" /><figcaption>Photon in the client’s pipeline. A clinician enters a natural-text query, and Omic’s algorithm returns relevant data. Photon then extracts over 800 features from the data, and the model uses those features to predict key design decisions, which are then passed back to Omic’s platform to draw the visualizations. A future version of the system will use natural language processing to incorperate information from the user’s query into the design decisions.</figcaption></figure><h3>Finding Data</h3><p>As with many machine learning projects, finding labeled data was a challenge. Inside or outside Omic, I couldn’t find sizable set of raw data and corresponding “correct” visualizations that a model could learn from. Creating enough ground-truth design decisions to train a model would be impractical. So I started looking for the next best thing: a large set of human generated data visualizations that I could assume reflected pretty good design decisions on average.</p><p>I found the <a href="https://chart-studio.plotly.com/">Ploty Chart Studio Community Feed</a>, with nearly 2 million user-generated charts. This seemed a nearly ideal source: many of the user-generated charts come packaged with the data from which they are generated, and the design parameters that users chose are baked in to the ploty code that defines their charts.</p><h3>Data Cleaning</h3><p>For my purposes, the plotly data required a lot of cleaning. Not all charts on the feed contain data. Some are less common types of charts that I wasn’t interested in (<a href="https://chart-studio.plotly.com/feed/?q=streamtubes#/">steamtubes</a>, anyone?). I chose to limit the data set to nine kinds of charts. I included the seven most common chart types on the Plotly Community Feed: line, scatter, bar, box, pie, histogram, and heatmap. I also also included sankey plots (common in visualizing connections between genomic data) and tables (for cases when information is best presented as a grid of data). I dropped charts that combined trace types to create complex visualizations that seemed beyond the scope of a minimum viable product. Finally, there were tons of near-duplicates, mostly slightly different charts drawn from identical datasets, presenting a bit of a fuzzy duplicate problem.</p><p>After cleaning and agressivly de-duplicating the 1.9 million chart dataset, I was left with just under 110,000 unique data sets with associated charts. I inferred the chart type from the trace marks in the code for each chart, and these became the labels.</p><h3>Feature Extraction</h3><p>In this first version of Photon, I wanted to optimize the model to predict the right chart type to draw, but also to be sure that the model could be adjusted to learn other key design decisions too. The plotly feed data also defines what is on the x and y axes, and how many fields are drawn on each axis. As a multi-label model, Photon is capable of learning those as well.</p><p>One challenge in setting up a model to learn from <em>any</em> tabular data set is finding features that “describe” the data as features that the model can understand. Feature extraction is generally considered one of the less fun tasks in machine learning, but it ended up being the most interesting part of Photon.</p><p>I tried and failed to avoid explicitly extracting features. Inspired by the precident paper <a href="https://github.com/victordibia/data2vis">Data2Viz</a>, I tried tokenizng each dataset and feeding it to a recurrent neural network based on Google’s open-source general-purpose model for machine translation <a href="https://google.github.io/seq2seq/">Seq2Seq</a>, since I was trying to “trasnlate” data into code for charts. It was too complicated, and I couln’t get it to predict the best chart type any better than random, so I returned to strategizing about how to extract features.</p><p>I wanted to mimic the way a human analyst might explore a tabular dataset to see what is there, in order to design a visualization. I also found a really interesting precident in <a href="https://vizml.media.mit.edu/">VizML</a>, a paper from MIT Media Lab, and ended up lifting their approach to feature extraction. Here’s how it works:</p><p>Imagine a spreadsheet. You can calculate summary statistics on each column, like the mean and median for numerical data or mean frequency for catigorical data. The data type and column names could be useful too. Then, you can calcualte pairwise statistics between columns, because illuminating relationships between columns is often what visualization is all about. I calculated various correlation coeficients, the number of shared catigorical values, and other relational statistics between each possible pair of columns. Finally, you can aggrigate many of those into table-level statistics. The number of columns, the portion of columns that are numerical vs catigorical, and the mean pairwise correlation are examples. Many of these table-level features endend up being the most important features in the model. In total, Photon calculates 846 features for each data table.</p><p>In the plotly data, there are more than 300 times more line plots than sankey plots. The data needed to be balanced between classes befoer we could train it.</p><p>Without balancing, models can esentially ignore infrequent classes. I used <a href="https://www.jair.org/index.php/jair/article/view/10302">SMOTE (Synthetic Minority over-sampling Technique)</a> to synthesize more examples of the minority classes and balance the dataset.</p><h3>Model Structure and Tuning</h3><p>Features in hand, I wanted to use a relitavely simple and transparent model to predict chart types. A random forest model seemed up to the job of quickly making predictions from a relitively large number of features. To find optimal hyperparamiters for the model, I first did a random search of a broad hyperparamiter space, training models for random combinations of hyperpamiters and evaluating those models using cross-validation (easier than it sounds with the RandomSearchCV class in scikit-learn), and then grid-searching combinations of a narrow set of hyperparamiters to land on optimal ones.</p><h3>Results</h3><p>I tested Photon on a hold-out subset of the plotly data. Photon’s accuracy is 71% on nine chart types. In other words, of all the pairs of data sets and charts that humans made from those data sets on the plotly feed, the model predicts the same chart type 71% of the time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7-nCmhFOw3X9z56Mj_sNRA.png" /><figcaption>Confusion matrix compares Photon’s predictions to true labels on a hold-out subset of the plotly community feed data set. Photon’s predictions are least likely to correspond to true human design decisons for tables and pie charts. In both cases, photon often draws a bar chart instead.</figcaption></figure><p>But we know that there are multiple legitimate ways to visualize most data sets. And Photon is not at all equal in its precision. Of the data that ploty users visualized as tables, Photon is more likely to choose to visualize the same data as a bar chart. And it only chooses pie charts about 50% of the time for data that users visualized with pie charts (most of the rest of the time, it draws a bar chart). Given the issues with <a href="http://www.storytellingwithdata.com/blog/2011/07/death-to-pie-charts">pie charts</a> and the fact that we’re trying to present more data more visually, I think I can get behind both of those choices.</p><p>Photon is now operational in Omic’s beta software, and is being used by researchers in the unprecedented global push for understanding and treating COVID-19.</p><p>see the <a href="https://github.com/devonds/viz">code on GitHub</a></p><p>download the data: <a href="https://drive.google.com/file/d/16RioCknQirQ5ZiALhTDXIgQ8uDI7JDyB/view?usp=sharing">features and labels for ~110k visualizations</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=efac5b5495d9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Coke and Potato Chips: Daydreaming a New Conversation on Nutrition and Food Security]]></title>
            <link>https://medium.com/bullshit-ist/coke-and-potato-chips-daydreaming-a-new-conversation-on-nutrition-and-food-security-104c24e12984?source=rss-454fc4c77eaa------2</link>
            <guid isPermaLink="false">https://medium.com/p/104c24e12984</guid>
            <category><![CDATA[agroecology]]></category>
            <category><![CDATA[nutrition]]></category>
            <category><![CDATA[food]]></category>
            <dc:creator><![CDATA[Devon Sampson]]></dc:creator>
            <pubDate>Tue, 08 Sep 2015 18:48:56 GMT</pubDate>
            <atom:updated>2016-11-07T23:34:11.983Z</atom:updated>
            <content:encoded><![CDATA[<h2>Coke and Potato Chips: Daydreaming a New Conversation on Nutrition and Food Security</h2><p><strong><em>When we talk about nutrition in the food movement, we too often talk about telling poor people what to eat. Let’s listen to them instead.</em></strong></p><p>I’m in Mexico City for a conference on agroecology and food sovereignty. This meeting focuses on farmers’ organizations and farmers movements. It is hosted by <a href="http://www.anec.org.mx/">ANEC</a>, an association of Mexican farmers unions, in association with <a href="http://www.iatp.org/">IATP</a>, the Institute for Agriculture and Trade Policy, a think tank based in Minnesota. As I understand it, the goal is to bring together representatives of farmers movements, progressive funders who want to support them, and a handful of activist-scholars. We will hole up in a hotel in the middle of Mexico City with the ambitious goal of setting an agenda for advancing agroecology and food sovereignty in Latin America. We will write a declaration.</p><p>One of the things I love about Mexico City is a pervasive feeling I have here that the world is new and in the process of being formed. Radical scholars are always reminding ourselves that another world is possible; here, that feeling that the world is unfolding gives me the sensation that the distance between this world and that possible one is not that great, just like the distance between the huge hotel where the conference will be held and the nearest juice stand or tamale lady. Maybe it’s the continual re-making of the city, the newness that had rebel journalist John Ross talking about how as hard as he tried to learn the streets of his adopted city, new construction would re-arrange them faster than he could keep up. Maybe it’s the collection of leftist leaders that, ousted by coups, live in Mexico City as glamorous refugees. Maybe it’s the palpable tradition of leftist artists and public intellectuals, and the cultural imprint of dozens of radicals in exile from all over Latin America, the traces of Fidel and Ché plotting the Cuban revolution in a corner café. I’ve got to admit, I’m excited to be in Mexico City to work on a declaration.</p><p>My friend Zoe, whom I met in Mexico City when I sat next to her on the bus at a Fulbright program orientation, and who has worked closely with ANEC over the past several years, invited me to the conference. She told me that I would participate in and help to facilitate one of several working groups, organized by themes that seem to me pretty accurate representations of the most pressing issues in Mexican food systems right now: agrobiodiversity and climate change, gender and generational succession, knowledge and alternative technologies, and nutrition and food sovereignty.</p><p>I called her. “I should be in the agrobiodiversity and climate change group”, I said. After all, had just turned in my dissertation on the ways that agrobiodiversity supports food security on small farms, especially during drought.</p><p>“The thing is,” she told me, “we really need someone to help with the nutrition and food sovereignty group”, and, she reminded me, my dissertation is on agrobiodiversity <em>and food security</em>.</p><p>“I really think my expertise is in agrobiodiversity,” I said. Then, less pretentiously, I told her, “I don’t really know that much about nutrition.”</p><p>“That’s ok.” She wouldn’t be convinced.</p><p>“And I think I piss off nutritionists,” I said, trying one last time.</p><p>“That’s what we want”, Zoe said.</p><p>She was paying, so I agreed.</p><p>This spring, at a meeting of the Association of American Geographers in Chicago, I was on a panel about agrobiodiversity and food security. Most of what I do know about nutrition science I learned from the brilliant panelists there, and from reading up on the subject on the plane to Chicago in an effort to not look stupid. I realized that there are different definitions, or at least different emphases, that people have in mind when they talk about food security. In my research I operationalized the idea of <em>food security</em> as the opposite of hunger: as a minimization of the chance of running out of food, and the ability to make it through hard times without going hungry. That framework made intuitive sense to me. Later I realized that most of the new research on the link between biodiversity and food security operationalizes food security in terms of nutrition, so a food secure household is one that consumes sufficient quantities of calories, proteins, vitamins and minerals, et cetera. While I was measuring food security in terms of the chance of running out of food, and the many ways people have of coping with shortfalls and mitigating the risk of hunger, most of my colleagues were measuring what people eat, and evaluating that in relationship to a nutritional understanding of a sufficient and healthy diet.</p><p>The nutrition-centered approach to thinking about and measuring food security has a lot of advantages. It’s easier to compare calories and nutrients across different kinds of food, making comparison possible across different cultures and even socioeconomic classes that eat very different foods. It is less subjective to measure exactly what foods people eat than to rely on people’s memories of instances of food shortfalls and hardships. Since I didn’t measure calories or nutrients that people consumed during my study in Yucatan, some scholars consider my results too reliant on people’s own reporting of their experiences with hunger. A paper I submitted to the Proceedings of the National Academy of Sciences was rejected, along with a note explaining that the editors found”the method of “self-reporting” without some backup verification… not convincing.”</p><p>There are also drawbacks to the nutrition-centric approach. The most glaring, in my opinion, is the reliance on the researcher’s definition of a “healthy diet” in terms of calories and nutrients. The United Nations Food and Agriculture Organization (FAO) <a href="http://www.fao.org/3/a-i4646e/index.html">estimates the number of undernourished people in the world each year</a>, and their definition of a sufficient diet as “minimum needs for a sedentary lifestyle” <a href="http://journals.cambridge.org/abstract_S0892679413000191">has been criticized</a> for, among other problems, having little to do with the physiological reality of being a farmer. When the FAO adjusts the caloric threshold to reflect the food needs for “normal activity”, whatever that may mean, the number of malnourished people in the world increases dramatically: suddenly, <a href="http://journals.cambridge.org/action/displayAbstract?fromPage=online&amp;aid=9010215&amp;fileId=S0892679413000191">nearly half a billion more people appear to be malnourished.</a> Researchers’ definitions of a sufficient diet can be at least as arbitrary as people’s own reporting of experiences with hunger.</p><p>If I’m completely honest though, the main reason that I chose to ask people about their experience with hunger, rather than measure their food intake, is that it felt better. Talking about the experience of hunger seemed to hold more promise for creating an understanding together, rather than extracting data. As I reviewed methodologies for measuring food security, the ones that ask participants to keep track of their food intake through food diaries, or that have people recall everything they ate over the last 24 hours, felt strangely inhuman, focused on the food but not the people who ate it. To me, asking about hunger — when it happens, why it happens, how people cope with it — felt more respectful of people struggling with meeting their basic needs. These were not easy conversations, but they sometimes ended with a sense that we were doing something important together by talking about an experience that is most stays hidden in rural, out-of-the-way places like the villages of Tzucacab.</p><p>In the conference room in the Hyatt in downtown Chicago, we discussed the different approaches we had taken to measure food security, in rural places in the Andes, Africa, and Mexico. We all agreed that agrobiodiversity — the impressive diversity of plants, animals and fungi that many peasant farmers grow and use — are is fundamental to healthy, reliable sources of food. After all, the people we work with all draw on that agrobiodiversity for every meal. We also agreed that it is very difficult to detect an effect of agrobiodiversity on food security or nutrition using the methods conventionally used in public health and epidemiology. Many factors, ecological and social, shape agrobiodiversity on small farms, and many more determine the reliability and quality of the food that farmers eat. The causes are too complex, too contextual, and linked by too many steps to reliably detect a statistically significant relationship between agrobiodiversity and food security, using the tools that we have so far. This area of study is in its infancy, so the discussion turned to how we can better measure food security and nutrition in ways that are relevant to peasant farmers’ livelihoods, and how to take into consideration the many factors that determine access to food. Behind this question lies another — what is, after all, a good or sufficient diet? And what determines people’s understanding of a healthy diet, and their desires for certain kinds of foods?</p><p>It seemed inevitable when someone brought up Coke and potato chips, sometime near the end of the roundtable discussion. In almost every public discussion about indigenous communities and food, someone brings up Coke and potato chips, pointing out that kids these days prefer to eat potato chips and drink Coke, even though more traditional snacks are both healthier and cheaper. The person raising this point is very rarely indigenous or poor, but almost always insists that we have to educate the poor and the indigenous about risks of drinking Coke and eating potato chips, and that we have to teach them to value their traditional foods again. Once, at the opening of our participatory photography exhibition at a university gallery in Mérida, Yucatán, someone spotted a bottle of Pepsi a photograph of a family lunch. She was outraged, and took it upon herself to explain the link between soda and diabetes to Leo, who took the photo in her home. I will always admire Leo for her poise in strange situations. I listened in as she explained that yes, she knew that soda was not healthy, and so did her family, and asked that the viewer consider the Pepsi in context. It shares the table with healthy, home-made food, and the lunch is a special occasion, a Sunday afternoon with her cousins who are visiting from the coastal city where they work. Back in the conference room in Chicago, I wished Leo was there bring context and complexity to the discussion, and to counter the assumption that poor people drink soda because they are ignorant.</p><p>But she wasn’t, and it wasn’t until days later, daydreaming on the train to the Chicago airport, that it occurred to me what I should have done. I would have a bottle of Coke and a bag of potato chips hidden in my backpack, so that, while the conversation turned to devastatingly un-wholesome tastes of the poor, I could casually bring them out. I imagined the hiss and pop as I opened the bottle drawing everyone’s eyes to me. Would they stop talking at that point? I would open the potato chips, put one in my mouth, and start crunching.</p><p>I imagine everyone would be offended, but mostly for not taking the crusade against junk food seriously, and, surely, for eating during a panel. What they would <em>not</em> think, however, is that I lacked an understanding the nutritional content of my snack, or that I was in need of education about the risk factors for diabetes and hypertension. They would not see my snack as a grave danger to my health, or as a tragic threat to my culture and values. In their eyes, my food choice would not define my character. The conversation would have to turn to why. In this fantasy, I would point out that because of my race, my class, and my gender, no one would assume that I ate potato chips for every meal, and anyway, I would be judged more for my intellectual contribution to the panel than for my choice of snacks.</p><p>Here’s what I know so far, from the in-depth food security interviews we did with sixty families in Yucatan: People are well aware of diet-related diseases. They often put the blame on industrially-produced foods, especially meat, and wish that they could produce enough healthy protein on their farms to satisfy their families needs. And, for almost every wholesome home-made snack and fresh juice, there is a corresponding period of time that a woman takes to do it, competing with an endless list of tasks that make up women’s unrecognized labor.</p><p>In my train ride daydream, the conversation shifts to the ways we can listen to people about what they eat, what makes them feel healthy and not, what obstacles in their lives keep them from eating what they want to be eating, and, finally, to making a strategy for addressing those obstacles. But it was just a would-have daydream; so far, I don’t think I really have pissed off any nutritionists, yet. Sorry for the false advertising, Zoe. But I am going into this conference with a different daydream: that instead of making a plan for how to tell people what to eat, we make a strategy for listening to them. Maybe I’ll pack a coke and a bag of chips just in case.</p><p><em>Devon Sampson researches and writes about agroecology and food systems. More from Devon Sampson at </em><a href="http://www.devondsampson.com/"><em>DevonDSamspon.com</em></a></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2F0d62c1%3Fas_embed%3Dtrue&amp;url=https%3A%2F%2Fupscri.be%2F0d62c1%2F&amp;image=https%3A%2F%2Fupscri.be%2Fmedia%2Fform.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/0fda78740da0d4c7e8e7840bfc87f785/href">https://medium.com/media/0fda78740da0d4c7e8e7840bfc87f785/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=104c24e12984" width="1" height="1" alt=""><hr><p><a href="https://medium.com/bullshit-ist/coke-and-potato-chips-daydreaming-a-new-conversation-on-nutrition-and-food-security-104c24e12984">Coke and Potato Chips: Daydreaming a New Conversation on Nutrition and Food Security</a> was originally published in <a href="https://medium.com/bullshit-ist">Bullshit.IST</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>