Food and Exercise Recommender based on Caloric Intake and Food Preference¶

Being able to gain and lose weight is one of the biggest challenges people face when trying to improve their physical health, well-being, and/or appearance. It has proved extremely difficult for individuals to stay regimented and stick to not only their exercise routines, but to their dietary routines in order to achieve thier fitness goals.

According to an article by sundried.com, 95% of all New Year's goals are fitness related and of this 95%, only 10% thinks their goal will last after just 3 months. The article states that prime reasons for the lack of commitment to one's (fitness) goals stems from not having enough time, setting one's expectations too high, or not having a plan as to how one is going to go about their goal.

For fitness goals related to weight, health, and appearance, calorie count plays an enormous role in the progress seen, with a calorie surplus being used to gain weight and a calorie deficit being used to lose weight. By using data on the calorie count of various foods and the calorie burn of various exercises based on a person's weight, a user can keep track of their calories taken in, receive suggestions of food based on preference to hit their calorie counts, and can recieve the most effective form of exercise to burn calories and hit their daily calorie target, allowing them to reach their fitness goals much more easily.

In [10]:
import pandas as pd
df_food = pd.read_csv('calories.csv', index_col='FoodCategory')
df_food
Out[10]:
FoodItem per100grams Cals_per100grams KJ_per100grams
FoodCategory
CannedFruit Applesauce 100g 62 cal 260 kJ
CannedFruit Canned Apricots 100g 48 cal 202 kJ
CannedFruit Canned Blackberries 100g 92 cal 386 kJ
CannedFruit Canned Blueberries 100g 88 cal 370 kJ
CannedFruit Canned Cherries 100g 54 cal 227 kJ
... ... ... ... ...
Spreads Sunflower Butter 100g 617 cal 2591 kJ
Spreads Tapenade 100g 233 cal 979 kJ
Spreads Unsalted Butter 100g 717 cal 3011 kJ
Spreads Vegemite 100g 180 cal 756 kJ
Spreads Wild Honey 100g 286 cal 1201 kJ

2225 rows × 4 columns

Content of df_food¶

FoodCategory: Type of food (CannedFruit, Vegetables, Fast Food, Cheese, Etc.)

FoodItem: Specific food

per100grams: Weight/Volume of food (100g or 100 mL)

Cals_per100grams: Calories in the food per weight/volume

KJ_per100grams: KiloJoules of energy in the food per weight/volume

In [13]:
df_exercise = pd.read_csv('exercise_dataset.csv', index_col = 'Activity, Exercise or Sport (1 hour)')
df_exercise
Out[13]:
130 lb 155 lb 180 lb 205 lb Calories per kg
Activity, Exercise or Sport (1 hour)
Cycling, mountain bike, bmx 502 598 695 791 1.750730
Cycling, <10 mph, leisure bicycling 236 281 327 372 0.823236
Cycling, >20 mph, racing 944 1126 1308 1489 3.294974
Cycling, 10-11.9 mph, light 354 422 490 558 1.234853
Cycling, 12-13.9 mph, moderate 472 563 654 745 1.647825
... ... ... ... ... ...
General cleaning 207 246 286 326 0.721008
Cleaning, dusting 148 176 204 233 0.515199
Taking out trash 177 211 245 279 0.617427
Walking, pushing a wheelchair 236 281 327 372 0.823236
Teach physical education,exercise class 236 281 327 372 0.823236

248 rows × 5 columns

Content of df_exercise¶

Activity, Exercise or Sport (1 hour): Type of exercise

130 lb: Calories burned by 130 lb person doing exercise

155 lb: Calories burned by 155 lb person doing exercise

180 lb: Calories burned by 180 lb person doing exercise

205 lb: Calories burned by 205 lb person doing exercise

Calories per kg: calories burned per kg of weight of the individual

Data Usage in Solving the Problem¶

In order to help individuals stay on top of their daily calorie target, a user can input the foods they've eaten to count their calories or request to have foods given to them to meet their calorie count. Based on input foods, certain options will be weighted higher than others when finding foods to meet calorie count. When calorie count is exceeded, the most effective exercise to reach calorie goal will be provided based on user weight.