0% found this document useful (0 votes)
97 views15 pages

Food Recommedation System Based On Content Filtering Algorithm

The document describes a food recommendation system that recommends foods based on their nutritional values. The system allows users to search for foods based on main ingredients like milk or fish. When an ingredient is queried, foods containing that ingredient from the database will be listed and sorted based on their nutritional values like calorie content. The recommendation aims to provide users with healthy food options based on a content-based filtering algorithm and considering the nutritional breakdown of foods. The system has some limitations like only supporting specific ingredients for now and not including a wide variety of foods. The goal is to help users find healthy foods and make informed choices.

Uploaded by

Rose Mary Antony
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
97 views15 pages

Food Recommedation System Based On Content Filtering Algorithm

The document describes a food recommendation system that recommends foods based on their nutritional values. The system allows users to search for foods based on main ingredients like milk or fish. When an ingredient is queried, foods containing that ingredient from the database will be listed and sorted based on their nutritional values like calorie content. The recommendation aims to provide users with healthy food options based on a content-based filtering algorithm and considering the nutritional breakdown of foods. The system has some limitations like only supporting specific ingredients for now and not including a wide variety of foods. The goal is to help users find healthy foods and make informed choices.

Uploaded by

Rose Mary Antony
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

ABSTRACT

The project entitled “Food Recommendation System based on Content Based Filtering

Algorithm” recommends a food item list and displays the result depending on the

nutritional value of the food item. Here, a primary food ingredients is selected. If the food

items that are in the database have either ingredient as a main ingredient, then the food

items are listed in order of their nutritional value. (WHO, 2010.)

The project analyzes the food items in database and their main ingredients. When the

ingredient that the user queried about is found, in the database of the food items present,

they are sorted and filtered according to the nutritional value they contain. The amount of

calorie that the food contains is taken into consideration here. The suggestion to the user

is based on the amount of calories present in the food item. The recommendation is done

based on Content Based Filtering Algorithm.

Keywords: Food Recommendation, Nutrition, Nutritional Value in Food, Content Based

Filtering Algorithm

i
Food recommendation system using
content based filtering algorithm

CHAPTER 1: INTRODUCTION

1.1 Background

People make decisions related to food every day. They all think about what to eat, where

to eat, how much nutritional value this food has, can this make me lose weight, can this

food make me healthy and other questions. Recommendation systems help the user to

make fast decisions in these complex information spaces. The World Health Organization

is predicting that the number of obese adults worldwide will reach 2.5 billion by 2018 and

the issue is attracting increased attention. (WHO, 2010.)

Much of this attention is being paid to diet management systems, which have been

replacing traditional paper-and-pen methods. These systems include informative content

and services, which persuade users to alter their behavior. Due to the popularity of these

diet monitoring facilities, these systems hold a vast amount of user preference

information, which could be harnessed to personalize interactive features and to increase

engagement with the system and the diet program. One such personalized service, ideally

suited to informing diet, is a food recommender. This recommender could exploit the

nutritional values of the food to inform its recommendations.

The domain of food centered here are milk and fish. These are taken as the main

ingredients. Almost all of the foods, that include either of these as a main ingredient is

taken into consideration. Other factors include the nutritional breakdown, as well as the

1
Food recommendation system using content based filtering algorithm
cultural and social factors. Add this to the sheer number of foods and the fact that eating

often happens in groups, the complexity of the challenge is clear.

This recipe recommendation application can help the user to find their favorite food and

its nutritional value. This is done by searching the foods that contain one of the prime

ingredients and shows their nutritional value.

1.2 Objectives

The goal of the application is to provide a platform where users find their favorite food

and its nutritional value. This is useful for anyone who is health conscious or wants to

lose weight.

This application can be used as a standalone application or it can also be used as a part of

a more sophisticated application.

1.3 Scope

The application can help people who like to eat milk or fish. The application is targeted

towards a local audience, for now, and as of present it can only be used as a web

application that recommends food based in their nutritional value.

1.4 Limitation

• Only foods containing milk or fish can be searched.


• Only displays the nutritional value of the food.
• Does not contain a wide variety of food but only the popular ones in Kathmandu.

2
Food recommendation system using content based filtering algorithm
CHAPTER 2: REQUIREMENT AND FEASIBILITY
ANALYSIS

2.1 Literature Review

Chun-Yuen Teng, Yu-Ru Lin and Lada A Adamic wrote a paper titled “Recipe

Recommendation using ingredient network” which tells that the user’s preference of

ingredient, cooking method and food preferences greatly affect a person’s lifestyle and

their health. They tell how each ingredient works in many ways to make a person healthy

or dull. Each ingredient present in the food a person eats gives off different type of

nutrition to a person. They constructed networks that capture the relationship between

ingredients. The complement network that they worked on captures which ingredients

frequently come together. The network constituted of two large communities, namely

savory and sweet. The substitute network, derived from user-generated suggestions for

modifications, can be decomposed into many communities of functionally equivalent

ingredients, and captures users’ preference for healthier variants of a recipe. The

experiments reveal that recipe ratings can be well predicted with features derived from

combinations of ingredient networks and nutrition information. They found that foods do

not have a large diversity of ingredients. When a main ingredient is taken, the method of

preparation depends upon the person and the other ingredients used. (Chun-Yuen Teng,

2012)

According to a paper, co-written by Jeremy Cohen, Robert Sami, Aaron Schild and
Spencer

Tank titled “Recipe Recommendation”, they found that the ingredients used need to be

well established for their nutritional value, i.e., if the person knows beforehand what

3
Food recommendation system using content based filtering algorithm
nutritional values an ingredient contains then the person can prepare the food accordingly

and select other ingredients as required. (Jeremy Cohen, 2014)

2.1.1 Content based filtering algorithm

Content Based Filtering Algorithm: In a content-based recommender system, keywords or

attributes are used to describe items. A user profile is built with these attributes. Items are

ranked by how closely they match the user attribute profile, and the best matches are

recommended.

Content-based filtering recommends items based on a comparison between the content of

the items and a user profile. The content of each item is represented as a set of descriptors

or terms. The user profile is represented with the same terms and built up by analyzing

the content of items which have been seen by the user.

2.1.2 Limitations of content based filtering algorithm

• Items and attributes must be machine-recognizable.

• Cannot filter items on some assessment of quality, style or viewpoint. Because of

lack of consideration of other people’s experience, the system cannot make any

assessments of a quality, style or viewpoint for the item.

• Absence of personal recommendations. Due to the lack of consideration of other

people’s experience, recommendations are based on the item’s attributes, tags,

among others, and, therefore, missing any personality assessment.

4
Food recommendation system using content based filtering algorithm
• No new items to display: The system is unable to give an item surprisingly

interesting to a user, but not expected or possibly foreseen by the user. For

example, if a food of the same ingredient has been shown, the user probably

already knows about the food and, therefore, is not surprised.

2.1.3 Related works

Recommender system has been widely used in recent days, in the field of food

recommendation.

Choose MyPlate: It illustrates the five food groups that are the building blocks for a

healthy diet using familiar images – a place setting for meal. This helps users to thing

before eating and take a minute to contemplate about what is in the plate in front by

showing what the food is what nutritional values it contains.

Healthy Food Recommendation & Lists: If the user is not sure what to add to their list of

foods for a healthy diet, want to change their current diet and need nutritional guidelines

for a specific condition, diet, or lifestyle, this site is useful. With healthy foods that match

the user’s profile, their quick-start food lists can get users started right away with tracking

and analyzing what to eat. If users already started a list of “My Foods”, they can add one

or more quick-start lists to their existing list.

Dietary Guidelines: The Dietary Guidelines is a popular go-to source for nutrition advice.

Published for public health professionals, each edition of the Dietary Guidelines reflects

the current body of nutrition science. These recommendations help people make healthy

food and beverage choices and serve as the foundation for vital nutrition policies and

programs.

5
Food recommendation system using content based filtering algorithm
2.2 Requirement Analysis

A requirement analysis was done on the product and the following data was obtained:

2.2.1 Functional requirement

The user can search for the main ingredient needed.

Currently, only the main ingredients milk and fish are available. The list of foods will

appear and the user can select a food item. They will be guided to another page where can

see the nutritional value of the food.

2.2.2 Non-functional requirement

The user must enter a food item. In this version, only fish and milk are available. So, the

user enters “fish”. This will show a result of the foods that contain fish as a main

ingredient.

Currently, there is no login function to maintain a user preference.

6
Food recommendation system using content based filtering algorithm
Figure 1 - Use Case Diagram
As shown in Figure 1, the user can search for the desired food item. The user can then

view a list of related food item and select a desired food item to see its nutritional value.

The user receives the food item list based on the nutritional value of calories.

2.3 Feasibility Analysis

The following result was obtained while performing a feasibility analysis:

2.3.1 Operational feasibility

The end users are the clients of the application. They are the ones who search for the food

item. The server keeps the records of all food items and their nutritional value.

2.3.2 Technical feasibility

HTML is used to display content in the browser, CSS to make content look user friendly,

and JavaScript for making the web page interactive. At the server side, the logic is

implemented using python, Flask web framework for dynamic web page generation and

to display the predicted result in the browser as well as to handle page requests. A server,

client, and internet connection are required to function properly.

2.3.3 Schedule feasibility

The total estimated time for the development of the application is 1-2 weeks.

7
Food recommendation system using content based filtering algorithm

CHAPTER 3: SYSTEM DEVELOPMENT

3.1 Methodology and Algorithm

Seeing that the requirements of the application were clear, the waterfall model was used

to develop the application. The detailed methodology used to develop the application are

described in the following subsections.

3.1.1. Data collection

The list of food and their nutriotional value were collected using extracted from two

websites, [Link], and [Link].

The data collected was mainly of the foods that contain milk or fish as the main

ingredient. Since both are healthy foods, the other ingredients that are added to them

during the food preperation period are the contributors that increase the values of other

nutriotonal values like calories.

3.1.2 Data processing

The available data was divided into training set and test data. 80% of the data was used

for the training set.

3.1.3 Algorithm used

Content Based Filtering Algorithm: In a content-based recommender system, keywords or

attributes are used to describe items.

8
Food recommendation system using content based filtering algorithm
Calculate the weight of each feature, namely Calories, that has the lowest value. This step

is in order to make an accurate list of food items. If the category i has the lowest value Cj,

but it has many content’s features j in specific category i, the application needs to

compute the weight Wi of each feature content value Ci within that category. The equation

given below is adopted from below.

After computing the weight of each feature content, the highest weight is seen as having

the lowest value. Only the food items which have the lowest calories value is shown in

the list to the user. The list is sorted in value of the calories from lowest to highest.

3.2 System Analysis

For the system analysis of this application, following three methods have been used:

 Sequence Diagram 
State Diagram

3.2.1 Sequence diagram

9
Food recommendation system using content based filtering algorithm

Figure 2 - Sequence Diagram of the application

As in Figure 2, the user inputs a food item query in the application. The list of food with

the food item query with the main ingredient is shown. The user selects the desired food

and this will guide the user to a new page where all of the nutritional value of the food

will be shown.

3.2.2 State diagram

10
Food recommendation system using content based filtering algorithm

Figure 3 - State Diagram of Application

The Figure 3 explain the states of the application. When the user opens the application,

they can make a search for the food item desired. Then they are directed to a page where

there is a list of food items where the searched ingredient is the main ingredient. They

select a food item. Now, the nutritional value of the food is displayed.

11
Food recommendation system using content based filtering algorithm
CHAPTER 4: IMPLEMENTATION AND TESTING

4.1 Implementation

4.1.1 Tools used

The application is based on Flask framework. It uses python programming language in

back-end and JavaScript in front-end. MYSQL was used as DBMS for the application.

The algorithms were implemented in python.

4.2 Testing

4.2.1 Unit testing

Unit testing was performed to test correctness of various modules.

Test Case 1:

Title: Enter an ingredient

Precondition: The landing page of the application is open in the browser.

Test Step(s):

In the search bar, the user enters an ingredient. Here, the ingredients are currently milk or

fish.

Expected Output:

A list of food items is shown where the entered ingredient is the main ingredient.

Test Case 2:

12
Food recommendation system using content based filtering algorithm
Title: Click on a food item

Precondition: The user has selected an ingredient.

Test Step(s):

The user selects a food item with the selected ingredient as the main ingredient. In this

case, milk or fish.

Expected Output:

The user is directed to a page where the nutritional value of the food item is shown.

CHAPTER 5: MAINTENANCE

5.1 Corrective Maintenance

As application could be sold or deployed for public use. There could be unresolved issues

and if a user complains about it, the maintenance has to be done.

5.2 Adaptive Maintenance

The data in the application does not include all the ingredients and food items, thus the

data needs to be updated in future.

13
Food recommendation system using content based filtering algorithm
CHAPTER 6: CONCLUSION

6.1 Conclusion

The project Food Recommendation System was successfully completed by using Content

Based Filtering Algorithm. The data set were collected by web scraping which was

preprocessed on the basis attributes. The data were then used to model the system.

6.2 Recommendation

The data in the application is based on the data received from web scraping. In order to

further improve this product, it is important to collect data of all the ingredients and food

items.

14

You might also like