Chapter08 Data Science Case Studies

If you find this content useful, consider buying this book:

  • Take the duke/coursera specialization
  • Chapter 08: Data Science Case Studies and Projects #

    This chapter covers case studies in data science, machine learning, big data, and other topics related to data.

    Case Study: Data science meets Intermittent Fasting (IF) #

    Back in the early 1990’s I attended Cal Poly San Luis Obispo and majored in Nutritional Science. I picked this degree because I was obsessed with being a professional athlete. I felt like studying Nutritional Science could give me an extra edge. At this time, I learned of research about calorie restriction and aging.
    I was also involved in self-experimentation in my Nutritional Biochemistry class. We centrifuged our blood and calculated LDL, HDL, and total cholesterol levels. We supplemented with megadoses of vitamin C and then captured our urine to see what our body took in. It turned out that nothing was absorbed in a healthy population of college students because the body intelligently responds to the absorption of nutrients by increasing absorption sensitivity when levels are low. Vitamin supplements are often a waste of money.

    I took a year of Anatomy and Physiology and learned how to dissect the human body. Later, in my Biochemistry coursework, I learned about the Kreb cycle and how glycogen storage works 1. The body produces insulin to increase blood sugar and stores it in the liver and muscle tissues. If those areas are “full,” it puts that glycogen into adipose tissue, “fat.” Likewise, when the body is out of glycogen or aerobic activity is underway, fat tissue is the primary fuel. This fat is our “extra” gas tank.

    I also spent a year at Cal Poly as a failed Division I Decathlete walk-on attempt. One of the things I learned the hard way was that doing too much weightlifting was actively detrimental to sports performance like running. I was 6'2", 215 lbs, and could bench press 225 around 25 times (similar to an NFL linebacker’s bench press performance). I also ran the 1,500m (about a mile) in 4 minutes and 30 seconds and regularly led the pack in three-mile training runs with top Division I long-distance runners. I could also dunk a basketball from near the free-throw line and ran the 100m in 10.9.

    I was a good athlete and well rounded, but actively worked for years too hard in doing the wrong types of exercises (bodybuilding). My work ethic was off the charts, but also ineffective and counterproductive for the sport I chose. I also overestimated my ability to walk on to a Division I sport where I hadn’t even done many activities, like Pole Vault. I almost made the team too. There was one person in front of me. In this part of my life, though, almost didn’t count. This experience was the first thing I had tried my hardest at and ultimately failed.

    As a former silicon valley software engineer, I later discovered a word for this behavior: YAGNI. YAGNI stands for “You Ain’t Gonna Need It.” Just like the years I spent putting on 40 pounds of extra muscle that ultimately decreased my sports performance, you can work on the wrong things in software projects. Examples of this include building functionality that never exposes in an application or overly complicated abstractions like advanced object-oriented programming. These techniques are literally “dead weight.” They are actively harmful because they took time to develop, which could be spent working on useful things and permanently slow down the project. As the track and field example shown, some of the most motivated and talented people can be the worst abusers of adding unneeded complexity to a project.

    The field of Nutritional Science has a YAGNI problem as well. Intermittent Fasting is an excellent example of a simplification technique. It works a lot like how deleting half of a 2,000-word essay often makes it better. It turns out the decades of added “complexity” can be ignored and deleted: frequent snacks, breakfast, and ultra-processed foods 2.

    You don’t need to eat breakfast or snacks. To further simplify, you don’t need to eat many times a day. It is a waste of time and money. You also don’t need ultra-processed foods: breakfast cereal, protein bars, or any other “man-made” food. It turns out YAGNI strikes again with our diet. You also don’t need to buy anything for this method to work: books, supplements, or meal plans.

    There is a well-known problem called the Traveling salesman problem 3. The question is interesting because there is no perfect solution that finds the optimal route to travel in many cities. In everyday language, this means a solution is too complex to implement in the real world. It would take an increasingly long time to solve the concerning the data. Instead, computer science solves these problems using heuristics. A heuristic solution I wrote in graduate school isn’t incredibly innovative, but it comes up with a reasonable explanation 4. The way it works is to pick a city randomly; then, you always choose the shortest route when presented with possible routes. At the end solution, the total distance shows. You then rerun this simulation with however much time you have, and then pick the shortest distance.

    Why is Intermittent Fasting so effective? It also skips past the unsolvable complexity of counting calories to lose weight. Intermittent Fasting is a useful heuristic. Instead of counting calories, you don’t eat during blocks of the day 5, 7. These blocks could be as follows:

    Daily fasts:

    • 8 Hour Feeding Window or 16:8

      • 12pm-8pm
      • 7AM-3pm
    • 4 Hour Feeding Window or 20:4

      • 6pm-10pm
      • 7AM-11AM

    Longer fasts with more complex patterns:

    • 5:2
      • five days of normal eating and two days of calorie restriction, typically 500 calories.
      • Alternate-day Fasting
      • Eat normally one day and restrict calories another, typically 500 calories.

    I have experimented mainly with Daily fasts of 16 hours or 20 hours. As a data scientist, nutritionist, and serious athlete, I also come with data. I have data from 2011-2019 of my body weight 6. From the period of August 2019 to December 2019, I have mostly been on a 12:8 IF routine.

    Body Weight

    One thing I learned in analyzing body weight and experimenting with data is that a few small things make a big difference:

    • Avoiding “man-made food.”
    • Getting 8 hours of sleep (MBA and startups caused weight gain through sleep loss)
    • Daily exercise
    • Intermittent Fasting
    • You cannot exercise your way out of a bad diet (Heart Rate was in the low 40’s).

    What is an example of a meal that is YAGNI?

    Healthy Food

    • Mushroom Omelet with Avocado
      • Eggs
      • Shitake Mushrooms
      • Cheese
      • Avocado
      • Salsa

    It only takes a few minutes to make the fats, and whole foods make you feel satiated, and it is inexpensive.

    When I was “fat,” it was in periods when I didn’t do the above: working crazy hours at startups and eating food that “man” made. Working out in a fasted state takes a bit of getting used to, but I found that it increases performance in many sports I do: bouldering, weight lifting, HIIT training, and Brazilian Jiu-Jitsu. Likewise, I am very productive in writing software, writing books, and doing intellectual work. The main “hack” I add is the regular consumption of plain cold brew coffee and water.

    My conclusion is that Intermittent Fasting is one of the best ways to enhance a person’s life dramatically. It costs nothing and is simple to do, primarily if you practice it daily and backed by science. Why not try it?

    References:

    1. https://en.wikipedia.org/wiki/Citric_acid_cycle
    2. https://www.health.harvard.edu/staying-healthy/eating-more-ultra-processed-foods-may-shorten-life-span
    3. https://en.wikipedia.org/wiki/Travelling_salesman_problem
    4. https://github.com/noahgift/or
    5. https://www.dietdoctor.com/intermittent-fasting
    6. https://github.com/noahgift/intermittent-fasting/blob/master/intermittent_fasting.ipynb
    7. https://www.nejm.org/doi/10.1056/NEJMra1905136
    8. https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3151731/

    Notes: #

    To cite this research: DOI

    From NEJM, “Evidence is accumulating that eating in 6 hours and fasting for 18 hours can trigger a metabolic switch from glucose-based to ketone-based energy, with increased stress resistance, increased longevity, and a decreased incidence of diseases, including cancer and obesity."

    From NHS (Nurse’s Health Study), “Several lifestyle behaviors may influence whether or not a person can maintain energy balance over the long term. For instance, the consumption of sugar-sweetened beverages, sweets, and processed foods may make it harder to do so, whereas the consumption of whole grains, fruits, and vegetables might make it easier."

    Healthy Quantities

    This study also shows a data mining approach to solving obesity. Increase the number of Nuts, Fruits, and Yogurt. Decrease or eliminate Potato Chips, Potatoes, and Sugar-sweetened beverages (Note the ultra-processed and insulin spike link…). There are the top foods that contributed to weight gain:

    • Potato chips
    • Potatoes
    • Sugar-sweetened beverages

    These are the top foods that are inversely associated with weight gain (weight loss):

    • Nuts
    • Fruits
    • Yogurt