Discovering ketosis: how to effectively lose weight

Here is a chart of my weight vs. time in the past 16 months or so

weight vs. time in the past 16 months or so

The chart was generated from the data file weight.2015.csv by the script date-weight.r in this git repository. It requires R and ggplot2.

In the following I'll describe the thought process, other people ideas, and the software I used to lead me in the right direction.

Disclaimer:

The below is what worked, and I strongly believe is good for me and possibly for others. Your situation may be different. Listen to your own body.

JK :-) Let's promote truth for a change. To channel Galileo in the face of the inquisition: evolution has been hard at work for about 2 billion years shaping the chemistry of all eukaryotes, and mammals. The Krebs cycle, Glucose metabolism, insulin spikes, glycogen in the liver, Carnitine, Lipase, are as real for you just as they are for me. We may be vastly different in our genes and traits, but we are not different in our most fundamental chemistry.

Salient facts & initial observations

First DMV photo and weight (with full clothing)

Does a US typical lifestyle has anything to do with this epidemic? After reading on the subject, I could point at a few of the main suspects:

As in many other instances, I realized I need to think for myself. Ignore all "expert" advice. Question widely accepted ideas like the FDA "food pyramid". Start listening to my own body, my own logic & data I can collect myself and trust.

Once I did, the results followed.

What didn't work

In the past, I tried several times to change my diet. After reading one of Atkins' books, I realized, checked, and accepted the fact that excess carbs are a major factor in gaining weight. But that realization alone has not led to success.

My will power, apparently, was insufficient. I had too much love of pizza and bread. I would reduce my carb consumption, lose a few pounds (typically ~5 pounds), and then break-down, go back to consuming excess carbs, and gain all these pounds back, and then some. My longest diet stretch lasted just a few months.

It was obvious that something was missing in my method. I just had to find it. Obviously, I could increase my physical activity: say start training for a mini-marathon, but that's not what I felt comfortable with.

I realized early on that I need to adopt a lifesyle that not just reduces carbs, or add exercise, but is also sustainable and even enjoyable so it can turn into a painless routine. Something that:

Early insights & eureka moments

Early in the process I started using machine learning to identify the factors that make me gain or lose weight. I used a simple method: every morning I would weight myself and record both the new weights and whatever I did in the past ~24 hours, not just the food I ate, but also whether I exercised, slept too little or too much etc.

The format of the data collection file is very simple. A CSV with 3 columns:

Date, MorningWeight, Yesterday's lifestyle/food/actions

The last column is a arbitrary-length list of word[:weight] items.

The (optional) numerical-weight following :, expresses higher/lower quantities. The default weight, when missing is 1:

#
# vim: textwidth=0 nowrap
# Diet data file
#
# 'sleep' is at least 8-hours of sleep.
#
# Important: decrease weights for more hours of sleep or larger quantities of food.
# Decreasing a weight makes a feature _more_ important ("less causes more" effect principle)
#
Date,MorningWeight,YesterdayFactors
2012-06-10,185.0,
2012-06-11,182.6,salad sleep bacon cheese tea halfnhalf icecream
2012-06-12,181.0,sleep egg
2012-06-13,183.6,mottsfruitsnack:2 pizza:0.5 bread:0.5 date:3 dietsnapple splenda milk nosleep
2012-06-14,183.6,coffeecandy:2 egg mayo cheese:2 rice meat bread:0.5 peanut:0.4
2012-06-15,183.4,meat sugarlesscandy salad cherry:4 bread:0 dietsnapple:0.5 egg mayo oliveoil
2012-06-16,183.6,caprise bread grape:0.2 pasadena sugaryogurt dietsnapple:0.5 peanut:0.4 hotdog
2012-06-17,182.6,grape meat pistachio:5 peanut:5 cheese sorbet:5 orangejuice:2
# and so on ...

Then I wrote a script to convert this file to vowpal-wabbit training-set regression format. In the converted train-set the label is the change in weight (delta) in the past 24 hours, and the input features are what I've done or ate in the ~24 hours which led to this delta -- a straight copy of the 3rd column.

I was not dieting at that time. Just collecting data.

The machine learning process error convergence after partly sorting the lines descending, by abs(delta) to smooth it out, and 4-passes over the data, looks like this:

error convergence (after partial descending sort by delta)

You can reproduce my work by building your own data-file, installing vowpal-wabbit, and its utility vw-varinfo, and running make in this directory.

Here's how a typical result of running make looks like.

FeatureName       HashVal   ...   Weight RelScore
nosleep            143407   ...  +0.6654 90.29%
melon              234655   ...  +0.4636 62.91%
sugarlemonade      203375   ...  +0.3975 53.94%
trailmix           174671   ...  +0.3362 45.63%
bread              135055   ...  +0.3345 45.40%
caramelizedwalnut  148079   ...  +0.3316 44.99%
bun                  1791   ...  +0.3094 41.98%

... (trimmed for brevity) ...

stayhome           148879   ...  -0.2690 -36.50%
bacon               64431   ...  -0.2998 -40.69%
egg                197743   ...  -0.3221 -43.70%
parmagian          121679   ...  -0.3385 -45.94%
oliveoil           156831   ...  -0.3754 -50.95%
halfnhalf          171855   ...  -0.4673 -63.41%
sleep              127071   ...  -0.7369 -100.00%

The positive relative-score values are life-style choices that make you gain weight, while the negative ones make you lose weight. This particular data set is very noisy, since:

So I focused mostly on the extremes (start and end) of the list as presented above.

Despite the noisy & insufficient data, and the inaccuracies in weighting, the machine-learning experiments made 4 facts very obvious, pretty early:

The 'stayhome' lifestlye, which fell mostly on weekends, was a red-herring, I simply slept longer when I didn't have to commute to work.

It took me a while to figure out the sleep part. When we sleep we don't eat. It is that simple.

Moreover: we tend to binge and snack while not particularly hungry, but we never do it during sleep.

And our sleeping time is our fasting time.

But it is not enough to fast. We also need to channel our body chemistry to break-up excess stored-fat while we fast.

Further progress

You may note that in the top chart there's a notable acceleration in the rate of weight loss. The cause was deeper insights and better ability to sustain the diet the more I understood the causes of weight gain and loss.

Extending the fasting time was one major accelerator of weight-loss rate. I did that by:

This gave me 14-16 hours of fasting each day. Rather than the more typical 10-12 hours/day of fasting.

The 2nd accelerator was loading up on fat in order to feel full.

The 3rd accelerator was understanding the concepts of Glycemic index and Glycemic Load, and shifting whatever I chose to eat towards lower Glycemic loads.

I now feel pretty confident that I can go all the way back to my original weight when I first landed on US soil.

At the present rate, it should take not more than 2 years to completely reverse the damage of the past 20 years.

It is important to stress that I also feel much better the more weight I lose. As a welcome side-effect, all the bordeline-high levels in my blood tests, have moved significantly towards normal averages during the same period when I lost weight.

Beware of doctors who push statins instead of suggesting a better diet. Doubt anyone who tells you you need to reduce fat. Run away if they tell you "high cholesterol" is dangerous.

My data has taught me that the body is an amazing machine. It is extremely adaptive. Cholesterol is an essential building block for many essential by-products. The liver produces as much cholesterol as it needs. It is not our high fat consumption, it is the storage of fat process that makes us unhealthy. An enzyme called Lipase breaks-up fat. To raise the levels of Lipase so our body fat gets converted to energy, we need to give the body fat as an alternative to carbohydrates. When the body has depleted both the blood sugar and the glycogen (hydrated sugar) buffer in the liver, it has no other choice but to adapt and compensate. The source of energy (ATP synthesis) is switched from carbs to fats by producing more fat-breaking agents.

When Lipase (and all other enzymes in the fat-to-ATP chemical path) mobilize and their levels become elevated, we reach a new steady state (called ketosis) and that's when we start winning the weight battle.

In ketosis, our night sleep (fasting time) becomes our ally. The fat-breaking agents keep working while we sleep, breaking-up the stored fat. This leads to weight-loss, and a healthier state.

The bottom-line recipe - all you need to succeed:


Further reading:

Watch this nice 7:41 minute video of James McCarter in Quantified Self (an eye opener for me):