在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):arielf/weight-loss开源软件地址(OpenSource Url):https://github.com/arielf/weight-loss开源编程语言(OpenSource Language):Python 40.2%开源软件介绍(OpenSource Introduction):Discovering ketosis: how to effectively lose weightHere is a chart of my weight vs. time in the past 16 months or so:The chart was generated from a data-set In the following I'll describe the thought process, some other people ideas, and the code I used to separate signal from noise. This separation was critical to help lead me in the right direction. This github repository includes my code, a Q&A section, and links for further reading. Disclaimers:The below is what worked for me. Your situation may be different. Listen to your own body. The code here is designed to be used on your own data, not on mine. Also: this was not a scientific experiment, or a "study"; rather, it was a personal journey of experimentation and discovery. With these behind us, I'd like to channel Galileo in the face of the inquisition: evolution has been hard at work for 2 billion years shaping the chemistry of all eukaryotes, multi-cellular life and eventually mammals. The Krebs cycle, glucose metabolism, insulin spikes, glycogen in the liver, carnitine, lipase, are as real for you as they are for me. We may be very different in our genes and traits, some are more insulin resistant, for example, but we cannot be too different in our most fundamental metabolic chemistry. The chemistry which drives fat synthesis and break-up. Salient facts & initial observations
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 workIn 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. I could increase my physical activity, say start training for a mini-marathon, but that's not something I felt comfortable with. I realized early on that I need to adopt a lifestyle 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 momentsEarly in the process I figured I could use machine learning to identify the factors that made me gain or lose weight. I used a simple method: every morning I would weigh 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 file I kept was fairly simple. A CSV with 3 columns:
The last column is a arbitrary-length list of The (optional) numerical-weight following
Then I wrote a script to convert this file to vowpal-wabbit training-set regression format. In the converted train-set the label (target feature) 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 leading 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 You can reproduce my work by compiling your own data-file, installing all prerequisites, and running When you type Here's how a typical result looks like.
The positive (top) relative-score values are life-style choices that make you gain weight, while the negative ones (bottom) make you lose weight. And here's a variable-importance chart made from a similar data-set:Disclaimer: please don't read too much into the particulars of this data. Working with this particular data set, was pretty challenging, since:
So I focused mostly on the extremes (start and end) of the list as presented above, and just used the hints as general guidance for further study, experimentation, and action. Despite the noisy & insufficient data, and the inaccuracies in weighting, the machine-learning experiments made 4 facts pretty clear, pretty early:
The 'stayhome' lifestlye, which fell mostly on weekends, may have been a red-herring: I slept longer when I didn't have to commute to work, OTOH: my diet on stay-home days may have been different. 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. Our sleeping time is our longest daily fasting time. Please note that my explanations of the effects may not in fact be accurate or deeply scientific. The goal of all this was incremental discovery: experiment, check effect, rinse, repeat. Further progressYou may note that in the top (date vs. weight) 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 problem. 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 consuming fatty stuff (instead of carbs) 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 believe and hope that I can go all the way back to my original weight when I first landed on US soil. If I can keep the present rate, it should take 1-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, the few borderline/high levels in my blood tests, have moved significantly towards normal averages, during the period I lost weight. What was my data and clear improvement in health saying?Looking at my data, and reading more, convinced me that I should beware of doctors who push statins instead of suggesting a better diet. I started doubting anyone who told me I need to reduce fat. I run away if anyone now tells me "high cholesterol" in the diet is dangerous. Cholesterol, by the way, is an essential building block for many essential body by-products. The liver produces as much cholesterol as we need. Our body is an amazing machine. Billions of years of evolution have made it extremely adaptive. It is not our high fat consumption, it is the storage of fat process that makes us acummulate fat in the tissues and become unhealthy. An enzyme called Lipase breaks-up fat. Raise the levels of Lipase and our body fat gets consumed faster. To get there, 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. Our source of energy -- ATP synthesis -- switches from carbs to fats by producing more fat-breaking agents. The body is a "Flex Fuel" kind of machine, that has simply replaced one fuel (carbs) with another (fat). When Lipase, and all other agents in the fat-to-ATP chemical path, aka Beta oxidation mobilize, and their levels are elevated, we burn more fat and lose weight over time. In a low-carb/high-fat (LCHF) regime, our night sleep (fasting time) becomes our friend. The fat-breaking agents keep working while we sleep, breaking-up the stored fat. This leads to weight-loss, and a healthier state. And when we push even further, and cut carbs to really low levels, we may reach a new steady state, called ketosis, in which practically all our energy comes from fat, and that's when we really win big in the weight-loss battle. The above is a very simplified, and hopefuly easy to digest, version of what some diet books try to explain in hundreds of pages. My bottom-line recipe:
Further reading:
Documentaries:More videosA nice 7:41 minute video of James McCarter in Quantified Self (an eye opener for me): Questions, Answers, CommentsSome questions and comments I got and tried to answer AcknowledgementsBig thanks to the following people for contributing to this project in myriad ways, comments, references, corrections, etc. Anat Faigon, Ingrid Kane, Hans Lee, Steve Malmskog, Eyal Friedman, Shiri Shoham, Gabi Harel, Shingi, Noa Update: 2016-08-12: this project made Hacker News and reached the top place for a while. Thanks for some great comments by benkuhn, aab0, zzleeper, and others which helped me make it better. Special thanks to John Langford and the many other contributors to vowpal wabbit. License:This code and additional material are released under a permissive and simple 2-clause BSD licence. The one sentence summary of this is "as long as you don't sue me and not claim it as your own, you should be ok." |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论