3. The Need
Recommending Healthy Meals to Users for
Weight Loss
Meal Should lead to weight-loss
Should match users’ tastes & preferences
Should recommend different meals for
breakfast, lunch and dinner
5. The Solution
Make recommendations for items, not meals:
Break Meals into items like - (“Blueberry
muffins and Omelette” ) to two items : (1)
“Blueberry Muffins”, and (2) “Omelette”
6. (1) Separating Meals in Items
Read the data
meal = gl.SFrame.read_csv(‘meals.csv',delimiter=";")
meal.rename({'X1': 'userid', 'X2': 'mealdescription','X3':'mealtype'})
Tokenize the meals
7. (1) Separating Meals in Items(contd..)
Tokenize the meals
mealRow=re.sub(")|(|d+|, | ,|,|+|.|@| - |- | -|*| [a-z] | w
| and| n |and | and | with|with | with |/|; |;|:|%|=|^|#|
"|| a | of | in | if | on |half|nothing| sm |null|glasses|
glass","$", meal)
p = re.compile( '$$$$$|$$$$|$$$|$$|$') # Split
words separated by $ sign
dict1 = p.split(meal)
8. (2) Split meals in Lunch, Dinner ..
Basic SFrame filter based on meal category
bmeal = meal.filter_by(['Breakfast'], 'mealtype')
9. (3) Creating the Model
• bmodel =
gl.ranking_factorization_recommender.create(newBreakfastFrame
,
target=‘frequency',ranking_regularization=0.5,max_iterations=500
,num_factors=8)
• bmodel_name = ‘breakfast_model'
• bmodel.save(bmodel_name)
10. Item Similarity Recommender
Factorization Recommenders (learns latent factors)
Ranking Factorization Recommenders
Popularity Based Recommender
(4) Deciding between Recommenders
11. Can’t recommend unhealthy items like
Cookies
We need a classifier …
(5) Healthy Meals?
Healthiness Classifier
13. •Create Numpy Frames for Meals and
Healthiness
• Count Vectorizer (Experimented with ‘n’
n-grams)
•Apply Logistic Regression on the
Vectorized data
(6) Logistic Classifier (SciKit)