Nutrition and Politics

My dad developed diabetes when he was in his twenties, and struggled with it for the rest of his life. Throughout my childhood, I had a bunch of conversations with him about what diabetes was and how he was dealing with it. As I got older, I watched his health decline faster and faster. He died suddenly of diabetes related heart failure while I was in grad school.

Since then, I’ve read a lot more about nutrition and health. The more I learn, the more I believe that my dad was treated using the best advice politicians could give. GCBC goes into some detail about how politics played a huge part in how heart disease and diabetes were treated historically, and how a lot of evidence about the origins of those diseases was ignored.

Large portions of GCBC are spent explaining the history of nutrition science in excruciating detail. Study after study is held up and compared to everything else. After slogging through all of that, the takeaway seems to be that one guy was sure he was right, and everyone else fell in line and stopped studying (or believing studies about) other hypotheses.

Ansel Keys first popularized the idea that cholesterol was the main cause of heart disease after WWII. He then found a link between eating high fat diets and having lots of cholesterol. Nevermind that no causal studies were performed, he was convinced. The next fourty years saw the production of a number of not very convincing studies that were used to inspire huge changes in the American diet.

Once Keys had convinced a critical mass of scientists and politicians, everyone who questioned the idea that cholesterol was to blame was treated with derision in an epic example of groupthink. A government panel released a report called “Dietary Goals for the United States”, which recommended a diet for all Americans based on Keys’ cholesterol ideas.

The motivation for all of this seemed to be the mass prevention philosophy of Geoffrey Rose. The idea was that, even though all the studies on dietary fat hadn’t shown much impact for a given person, the impact on society was huge. For example, it was estimated that you could live an extra 4 months if you completely cut saturated fat out of your diet. That may not be much for you, but if everyone did that the effect would be huge.

Since 4 months of additional lifetime might not be enough to convince someone to completely cut saturated fat out of their diet, Rose explicitly advocated creating social pressure to be healthy. Social pressure, unfortunately, is often highly resistant to scientific evidence. This effectively meant that future scientific discoveries would have a very difficult time changing anything.

The science became political goals. The political goals led to social manipulations. After that, the early scientific ideas became dogma. Subsequent research on nutrition was interpreted in light of that dogma and very little advancement happened.

Or that’s the idea that GCBC espouses. I take less of a cynical attitude. It’s easy to make the right decisions with the benefit of hindsight. I’ve seen some talks that take a more conspiratorial view of things. I don’t think that these nutrition decisions were made optimally, but why ascribe to malice what can be explained by human nature?

Whatever the reason, the increasing incidence of heart disease and diabetes since “Dietary Goals for the United States” was released is only tragic.

Good Calories, Bad Calories

I’ve been hearing about Good Calories, Bad Calories for a while now. Several people have recommended it to me as a great source of nutrition wisdom. I was a bit pessimistic before reading it, since my understanding of nutrition has always been that most people (even the experts) aren’t really sure what’s going on.

After picking up a copy, I was surprised to find that it was mostly a chronicle of nutrition research over the past century and a half. I was definitely expecting more of a diet book. The author has his ideas about the healthiest way to eat, but a lot of the book is actually about all the different people who’ve researched aspects of nutrition throughout history.

I enjoyed reading the book, and I think that I have a much better sense of the details of nutrition now. I’m planning to write a blog post about a few of the major themes I see running through the book to cement my thinking on it.

These include:
1. The fact that large organizations (the AHA and the US gov’t) take half-formed scientific research as gospel. The result of that, according to GCBC, have been making people sick for a century.
2. Everything bad is good for you
3. Metabolic Syndrome is a thing
4. Aging and Cancer
5. Obesity

KiCAD libraries

I’ve been using KiCAD for my schematic capture and layout tasks for about a year now, and I find it to be the best free tool that I’ve seen. In the interest of making it easier to share my projects, I’ve put all of my KiCAD libraries on github: https://github.com/mogar/KiCAD_libs

I tend to organize my libraries in pairs. One library of symbols and one library of corresponding modules. That way I know where to find the footprint I’m looking for.

I started out using a library that had been created from the SparkFun Eagle libraries. This has worked pretty well and has a lot of common components, but footprints are often messed up. I’ve been fixing them as I run into issues, but definitely check all footprints from the library before you use it.

The other libraries have parts that I haven’t found in the SparkFun library. Those libraries are better maintained, but I still suggest you double check everything before using any of those parts.

Rise: Support Your Health

I’ve been working hard for the past six months designing Rise, a new quantified self health tracker. It’s an accelerometer-powered device that sits on a person’s leg and helps them keep track of how much they’re sitting. Sitting, and being generally sedentary, have been linked to a whole host of health problems. Sitting too much can lead to blood clots in the legs in the short term, and diabetes and increased risk of heart disease in the long run.

The health problems that sitting causes are pretty simple to avoid: just sit less. Even getting up for just a few minutes every hour can have a marked impact on the health of the average office worker. So if it’s so easy to solve the sitting problem, then why did I spend so much time working on it?

It’s because sitting is insidious. People don’t notice how much they sit, and when they do notice it’s often because health problems are already starting to crop up. Rise, our sit tracker, will not only track how long a person has been sitting but send periodic alerts to let the wearer know its time to stand up and walk around for a bit. We’re building apps for both Android and iOS so that this is accessible to as many people as possible.

It’s been a fun project to work on, and a great extension of the research that I did when I got my Master’s. We’ve launched an IndieGoGo crowdfunding campaign to help turn the prototypes into final products. I’m excited to see how the campaign goes, and to see my work actually get out into the world and help some people. If you’re interested, you can check it out here.

The industrial revolution

From Makers: The New Industrial Revolution:

Although we think of factories as the “dark satanic mills” of William Blake’s phrase, poisoning their workers and the land, the main effect of industrialization was to improve health. As people moved from rural communities to industrial towns, they moved from mud- walled cottages to brick buildings, which protected them from the damp and disease. Mass- produced cheap cotton clothing and good- quality soap allowed even the poorest families to have clean clothing and practice better hygiene, since cotton was easier to wash and dry than wool. Add to that the increased income that allowed a richer and more varied diet and the improved access to doctors, schools, and other shared resources that came with the migration to cities, whatever ill effects resulted from working in the factories was more than compensated for by the positive effects of living around them. (To be clear, working in factories was tough, with long hours and poor conditions. But the statistics suggest that working on farms was even worse.)

It’s interesting that the industrial revolution seems to have led to a net increase in health even at the beginning. I had always thought that people who worked in factories experienced much worse health overall. Given that the switch to agriculture did have a negative impact on health, it seems that social changes have pretty un-intuitive consequences.

Applying the Nyquist rate to Machine Learning

In traditional signal processing, you often want to be able to represent an analog signal accurately in digital form. To do this, you would use an ADC to sample the signal. If the signal is (for example) a voltage that varies with time, then you want to sample it at many points in time in order to be sure that the digital representation you’re building up looks the same as the original analog signal. The samples are arranged periodically, and the number of samples that you need is related to how fast the signal changes via the Nyquist rate. The idea behind the Nyquist rate is that the faster the signal changes, the more samples you need in order to accurately see those changes.

People often forget that even though this idea was originally developed for communications and traditional signal processing, it applies just as much to machine learning and classification. In classification, for example, you’re trying to identify the class of some feature vector based on feature vectors that have already been classified. The feature vectors are drawn from some sample space, and the classifications vary over the sample space just as voltage varies over time in traditional communications and DSP. In order to be sure that the classifier you learn correctly represents the true distribution in the sample space, you have to have enough examples drawn from that sample space.

While the number of training examples is important, it is equally important that the examples are drawn from all parts of the sample space. Unfortunately, many machine learning applications focus more on generating lots of training data than on ensuring that the training data is drawn from all portions of the sample space. This works well a lot of the time, especially when the sample space isn’t particularly complex or noisy. When you start to have a highly varying sample space, then it becomes more important that your training data meets the Nyquist rate.

Theoretically, knowledge of the Nyquist rate can also help minimize time spent collecting training data. If you already know how fast the classifications vary over the sample space, then you can determine how many samples you need to accurately reconstruct it. Unfortunately, this is often very difficult in practice, because you may not be able to choose where in the sample space your training data comes from.

Traditional signal processing also deals mainly with 1- and 2-Dimensional signals, while classification may be done on a feature space in the 10s to 100s of dimensions. That dramatically increases the computational cost of determining a simple function over the sample space. A trade-off is often made where more data is collected in order to minimize the processing time required to learn a useful classifier. Many of the learning algorithms are also fairly naive, and wouldn’t fare well with a minimum amount of training data.

Regardless of how much training data you choose to collect, you need to be sure that you collect enough data from different parts of the sample space. More samples will be needed in areas of the sample space where classifications change quickly. It can often be difficult to collect this training data, but it will dramatically simplify the process of learning a classifier.

Use the right metric

In the field of artificial intelligence, there’s a fairly simple (compared to other AI techniques) method called A* (pronounced A-star) that’s used to solve a lot of problems. It can be used in any situation where you’d want to find the shortest path from where you are now to some goal. This is a very common problem, and shows up everywhere from calculating the best airline routes to video game NPC AI. It’s useful in any kind of route planning, whether it’s a route through space or through some other set of sequential decisions.

A* works by comparing the state of the world now with the state of the world if a certain decision were made. Since it has to choose which decision to make before it knows what the result of a decision is, it uses a heuristic to approximate the result of different decisions and then chooses between those decisions. The heuristic approximates the distance to the goal after each given decision. There’s a bit more to it than that, but you can read about it on Wikipedia or something if you’re interested. What I find really intriguing about A* is the importance of the heuristic.

It turns out that A* doesn’t always work well. If the heuristic isn’t chosen well, then A* will do very poorly at finding a way to the goal. It may find a route that is much worse than what’s possible. Whatever heuristic is chosen needs to never over-estimate the true distance to the goal. AI researchers will spend a lot of time thinking up good heuristics for their application, often much more time than they spend implementing the path-finding A* algorithm.

What AI researchers realize that a lot of other people don’t is that the way you estimate the distance to your goal has a huge impact on how fast you reach it. I’ve been noticing recently that the standard heuristic is very poor in a lot of areas in life where people are trying to achieve something. I first noticed that in the field of education when I was having trouble learning about AI in the first place.

When I took my first few algorithms and AI classes, I got very high grades. I’m good at school and test-taking, so I got 4.0s in most of the classes that I took. Unfortunately, I was often unable to apply the information or implement the algorithms after the class ended. The heuristic I’d been using to see if I learned, my grade, was often over-estimating my progress. I was eventually able to truly learn and implement the different algorithms that were important, but I had to completely ignore grades while doing so. Instead, I just focused on small projects that included the algorithms. These small projects (what homework aspires but often fails to be) were a truer measure of progress than grades ever were.

Since noticing that grades were such a poor metric for education goals, I’ve been on the lookout for other places that this appears in people’s daily lives. Here’s what I’ve noticed so far. Can you think of any that I’ve missed?

  • Education: The default heuristic is grades, but number of completed projects is probably a better metric.
  • Life-success: It seems like a lot of people use income to measure this, but that’s a pretty limited metric and often seems to lead people to unhappiness. I would argue that autonomy is probably a better metric here, but I’m not sure how to measure autonomy.
  • Weight loss: I know a lot of people who have been working on losing weight and being healthier in general, but I think that weight is probably not a good heuristic for this. Body Mass Index does a lot better, but it’s a bit harder for the average person to measure accurately.
  • Relationship health: People tend to measure the health of a relationship by how long it’s lasted, but this is a very inaccurate guide at best. Lots of long relationships are pretty bad, but for one reason or another, the people don’t break up. Other relationships are short, but end up being very positive experiences for everyone involved. It seems like the happiness of the partners is a much better heuristic, but it’s also harder to measure.

In each of these cases, it’s pretty hard to measure something that’s actually a good heuristic so people choose a less useful heuristic. Using the worse heuristic, people can easily make measurements, but those measurements aren’t actually very useful. Even though good heuristics are often harder to measure, they offer much better results.

The two most important techniques in technical writing: grad school edition

In grad school you do a lot of technical writing. You write research summaries for your professors, guides for your fellow students, outlines for courses you’re TAing, and (if you’re lucky) you even get to write journal papers. You might assume from this that grad schools require English classes or writing classes. They do not (at least mine didn’t). In my experience, grad students learn to write by writing a lot and being judged on it.

Most of what I’ve written never gets more than a few comments or questions on the topic, but when I write journal or conference submissions, I tend to get a lot more structured feedback. Since the good feedback on my own writing has been fairly rare, the most helpful thing that I’ve done to learn how to write better is critique other people’s work. Critiquing other people’s work allows me to hone some writing skills without the emotional pushback of being invested in the content that’s already there. It works even better if I’m currently writing a paper while I’m editing someone else’s, because I can immediately apply what I learn from editing to the paper I’m writing.

As I’ve progressed as a writer, I’ve noticed that grammar and sentence structure are really only the first step to writing well. Once you memorize the rules, it’s pretty easy to throw together a sentence that doesn’t make someone cringe. The hard part comes when you try to use those sentences to convey complex ideas. What part of the idea do you want to present first? What if the audience doesn’t know the background material? How do you make the paper interesting? What do you do if nobody understands the thing you’ve written, or if they don’t catch the most important part of it?

What I’ve come to realize is that the answers to all of these questions revolve around two things: ordering concepts and choosing detail level.

Ordering Concepts

When you’re writing a technical paper, there’s a lot of different things to cover. The naive approach, which I’ve seen used a lot and which I’ve even used a time or two, is to present concepts in the order that you figured them out. For example, if you’ve designed a piece of hardware to solve the problem, you might write the document by going through all of the design decisions that went into it: going over what it has to do, the electronics design, the mechanical design, implementation, testing, the second prototype, re-testing, etc. This works alright, but it often isn’t the best way to go.

It can be much better to organize concepts by complexity instead of chronologically. This is especially true for documents that don’t detail a specific design or discovery. In this case, you want to start with the most simple concepts, and then present ideas that build on those. This kind of document leads the reader from simple to complex, rather than from start to finish. If you’re writing a report on the effects of opium use on Chinese culture, then you might want to start with the individual effects of opium, then progress to interpersonal effects, large scale social and economic impact, and then the whole historical picture.

There are many more ways to organize a paper than just these two, but these are the ones I’ve had the most success with. The main thing you want to do is have some kind of organization at all. Don’t start writing without knowing what the overall organization of the paper is. It can be annoying to have to sit down and think things out when you really want to get started writing, but its’ worth it. For a document you might spend a week or more on (or a month or more), spending some time up front on figuring out the organization structure can save you lots of time in the end.

Choosing Detail Level

I’ve read some incredibly boring papers about subjects that I loved. The main thing that all of these papers had in common was that they used the same level of detail throughout the paper. New writers are often more comfortable at a single level of detail, so their paper either reads like a list of facts (if they’re very detail oriented) or feels like it has no substance (if they’re always high level). When it comes to technical writing, I’ve noticed a lot more of the former.

No matter who’s reading your paper or why, you have to get them to care about the content if you want them to remember it. Often they’ll do this themselves if you can show them why the content is relevant. When encountering new information, people need some way to connect it to things they already know in order to retain it. This is why lists of facts are so hard to read, there’s no high level context. The high level context before lots of facts and theory will prime the reader with similar things they’ve heard before. This allows them to associate what they’re reading with what they already know, and it makes the document more interesting.

On the other hand, if all you give is high level context, then the reader won’t learn anything from your paper. At that point, there’s no reason for them to even read it. You need the lower level detailed explanation. With technical writing, this usually isn’t the hard part. As a grad student, this was always what I started with when I had to describe a study and the results.

It’s clear you need both high level context and low level detail to make your paper worth reading. The main question is what ratio to use and how to organize the high and low level sections.

My own opinion is that each large concept needs some high level to tie it to things the reader already knows before the low level explaining the concept itself. When figuring out how to arrange these, I usually fall back on that old teaching advice “first tell them what you’ll tell them, tell them, then tell them what you told them”.

Whenever I have a new concept to cover (in the right place according to my outline of course) I introduce it with some text about why it’s important. Then I go over the concept. Then I talk about what the concept means and what it implies about other things in my paper. Often, this serves as a good introduction to the next concept I want to write about. This is pretty similar to the topic sentence/detail sentence/transition that they taught me in elementary school, just on a larger scale.

Putting it all together

I’ve found that using these two concepts not only makes my writing better, it makes my writing faster. Once I have an outline using whatever structure I think is best for the paper, I can go in and add some context in each section talking about why the different sections are important. That’s easy to write, because I just write down why I put the sections there in the first place. Then I can put in the details of each point.

The whole thing is an iterative process, so I usually end up with a different outline or structure than the one I started with. The act of adding in context and details in different places reminds me of other things I need to cover so that it all makes sense. After that, it’s just a matter of editing it 40 or 50 times before I can send it in.

Voting and the Prisoner’s Dilemma

Voting is important to me. It’s something that I do every time elections roll around, and it’s something that I take a lot of pride in. I wouldn’t say that I’m the most political guy in the world, but I definitely have strong opinions about the best direction for my country to go. I want to make sure that those opinions get counted and have an effect.

That’s why I’m so bothered by people who don’t vote, especially if those people agree with me. People’s excuses for not voting are as numerous as the non-voters themselves, but they usually fall into a few different categories. There are the people who don’t vote because they’re too lazy. Some don’t vote because they just don’t care (or claim not to, they sure complain about the government a lot for people who don’t care). Others don’t vote because they say it’s not worth it.

It’s that last group that I want to address here. I’ve recently been in a few different conversations with people who feel that their vote has such a small impact that it’s not worth the time it takes to get informed and actually cast their ballot. The people I’ve met who think this way tend to be economists and computer scientists, so it’s not like they’re ignorant about the situation. From their perspective, they’re probably making the right choice. However, that choice is predicated on the fact that many other people with similar views will be voting.

Voting is the Prisoner’s Dilemma played at scale. There are huge groups of people who can either defect (not vote) or cooperate (vote). Assume for simplicity that each issue is divided on party lines and each party is the same size. In that case, each individual voter is playing the prisoner’s dilemma with people of their own party.

If the person defects and doesn’t vote, they get the extra time and energy they would have spent on voting to use for other things. If everyone defects, then the bill/politician/whatever that they wanted gets voted down by the other party.

So when people who share my political ideas say they don’t vote, I get upset. I don’t much mind that my vote is then that much more important. What I do mind is that those people are making it less likely that the world turns out how I want it.

This is a bit different than the popular idea that voting is a civic duty, and that everyone should vote. Basically I’m saying that I only want people who agree with me to vote. I’m still working on how to reconcile that with my general belief in the process of democracy.

Mood Monitoring and Fun Density

I’ve been getting more into the quantified self movement recently. The idea is that by tracking what you do and what the result is, you can understand yourself better. If you sift through the data, you can also find pretty easy ways to improve your life.

To get my feet wet measuring my life, I downloaded an app to my phone that will periodically ask me how I’m doing. I can answer anything from “normal” to “ok” to “excellent” on the positive end. On the negative end, I could answer “not good”, “terrible”, etc. When I make an entry about how I’m doing, I can also leave a note about what I was doing at that time. Once I have a large set of data from several weeks, I can go through and pull out patterns.

I first read about doing this in The Motivation Hacker, by Nick Winter. In it, he describes how he does a lot of new things and logs how he feels about them. Based on those logs, he figures out the fun density of different activities and tries to only do activities that have high fun density. He uses the example of white water rafting, where he has to travel to the river (not good), then rafts (ok with periods of awesome during rapids), then travel home (not good). His final conclusion after rafting was that it wasn’t worth it, because the fun density was low.

I like the idea of fun density as a way to measure activities, but I think that Winter’s application of it might be a bit flawed. Specifically, I think this because he talks about his own mood monitoring as a logarithmic measure. In his method, ok is twice as fun as normal, and good is twice as fun as ok. When he represents them with numbers, he only uses 1 to 10 (1=terrible, 10=excellent). He then takes the time average using that logarithmic scale of 1 to 10, not the experienced scale of 2^1 to 2^10. This means that his fun density measurements will undervalue short periods of high fun, which matches my surprise at him not wanting to go white water rafting again.

Now, I’m not saying that he should go white water rafting again. If he actually didn’t think it was worth it, that’s totally fine and he should do other things he finds more fun.

What I am saying is that logarthmic rating systems are a bit tricky. If rapids during rafting actually are an 8, and lasted for like twenty minutes of a two hour raft that was a 6 on average, and had a two hour ride there and back that was a 4, then his experienced average would be (20*2^8+100*2^6+240*2^4)/360 ~ 42. That 42 is about 5.4 on Winter’s scale, not the 4.7 that a simple average would give.

(To be fair, Winter also got a headache on his rafting trip that dropped the last hour of rafting down to a 4. Taking this into account, we get (20*2^8+40*2^6+60*2^4+240*2^4)/360 ~ 34.6667. This about 5.1 on his scale. That’s definitely less than his daily average (6.2!), but it’s more than the 4.4 that he was giving it.)

I’m pretty excited to start finding patterns in my own experienced fun levels. Having never tried to optimize my life for fun, I think my fun density might be pretty low. In a few weeks, I’ll have enough data to start finding things to do that improve my fun density. When I start doing that, I’m going to make sure that I don’t underestimate the impact of short periods of extreme emotion.