Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Product Recommendation System Documentation

Download as pdf or txt
Download as pdf or txt
You are on page 1of 59

Vision of KMIT

Producing quality graduates trained in the latest technologies and related tools and striving to make India
a world leader in software and hardware products and services. To achieve academic excellence by
imparting in depth knowledge to the students, facilitating research activities and catering to the fast
growing and ever- changing industrial demands and societal needs.

Mission of KMIT
• To provide a learning environment that inculcates problem solving skills, professional, ethical
responsibilities, lifelong learning through multi modal platforms and prepare students to become
successful professionals.
• To establish industry institute Interaction to make students ready for the industry.
• To provide exposure to students on latest hardware and software tools.
• To promote research based projects/activities in the emerging areas of technology convergence.
• To encourage and enable students to not merely seek jobs from the industry but also to create
newenterprises.
• To induce a spirit of nationalism which will enable the student to develop, understand lndia's
challenges and to encourage them to develop effective solutions.
• To support the faculty to accelerate their learning curve to deliver excellent service to students.
Vision & Mission of CSE
Vision of the CSE
To be among the region's premier teaching and research Computer Science and Engineering departments
producing globally competent and socially responsible graduates in the most conducive academic
environment.
Mission of the CSE

• To provide faculty with state of the art facilities for continuous professional development and
research, both in foundational aspects and of relevance to emerging computing trends.

• To impart skills that transform students to develop technical solutions for societal needs and
inculcate entrepreneurial talents.
• To inculcate an ability in students to pursue the advancement of knowledge in various
specializationsof Computer Science and Engineering and make them industry-ready.
• To engage in collaborative research with academia and industry and generate adequate resources
for research activities for seamless transfer of knowledge resulting in sponsored projects and
consultancy.
• To cultivate responsibility through sharing of knowledge and innovative computing solutions that
benefit the society-at-large.
• To collaborate with academia, industry and community to set high standards in academic
excellence and in fulfilling societal responsibilities.
PROGRAM OUTCOMES (POs)
1. Engineering Knowledge: Apply the knowledge of mathematics, science, engineering fundamentals
and an engineering specialization to the solution of complex engineering problems.

2. Problem analysis: Identify formulate, review research literature, and analyse complex engineering
problems reaching substantiated conclusions using first principles of mathematics, natural sciences, and
engineering sciences
3. Design/development of solutions: Design solutions for complex engineering problem and design
system component or processes that meet the specified needs with appropriate consideration for the public
health and safety, and the cultural societal, and environmental considerations.
4. Conduct investigations of complex problems: Use research-based knowledge and research methods
including design of experiments, analysis and interpretation of data, and synthesis of the information to
provide valid conclusions.
5. Modern tool usage: Create select, and, apply appropriate techniques, resources, and modern
engineering and IT tools including prediction and modelling to complex engineering activities with an
understanding of the limitations.
6. The engineer and society: Apply reasoning informed by the contextual knowledge to societal, health,
safety. legal und cultural issues and the consequent responsibilities relevant to professional engineering
practice.
7. Environment and sustainability: Understand the impact of the professional engineering solutions in
societal and environmental contexts and demonstrate the knowledge of, and need for sustainable
development.
8. Ethics: Apply ethical principles and commit to professional ethics and responsibilities and norms of
the engineering practice.
9. Individual and team work: Function effectively as an individual, and as a member or leader in diverse
teams and in multidisciplinary settings.
10. Communication: Communicate effectively on complex engineering activities with the engineering
community and with society at large, such as, being able to comprehend and write effective reports and
design documentation make effective presentations, and give and receive clear instructions.
11. Project management and finance: Demonstrate knowledge and understanding of the engineering
and management principles and apply these to one's own work, as a member and leader in a team, to
manage projects and in multidisciplinary environments.
12. Life-long learning: Recognize the need for, and have the preparation and ability to engage in
independent and life-long learning in the broadest context of technological change.
PROGRAM SPECIFIC OUTCOMES (PSOs)

PSO1: An ability to analyse the common business functions to design and develop appropriate
Information Technology solutions for social upliftment.
PSO2: Shall have expertise on the evolving technologies like Python, Machine Learning, Deep Learning, Internet
of Things (IOT), Data Science, Full stack development, Social Networks, Cyber Security, Big Data, Mobile Apps,
CRM, ERP eetc..

PROGRAM EDUCATIONAL OBJECTIVES (PEOs)

PEO1: Graduates will have successful careers in computer related engineering fields or will be able
tosuccessfully pursue advanced higher education degrees.
PEO2: Graduates will try and provide solutions to challenging problems in their profession by
applyingcomputer engineering principles.
PEO3: Graduates will engage in life-long learning and professional development by rapidly adapting
changing work environment.
PEO4: Graduates will communicate effectively, work collaboratively and exhibit high levels of
professionalism and ethical responsibility.
PROJECT OUTCOMES

P1: Understanding the working of artificial neural network and logistic regression.
P2: Training the model to predict the chronic kidney disease.
P3: Developing an efficient and on-hand web interface to predict chronic kidney disease.
P4: Hands-on experience on Node JS, Sklearn and TensorFlow.

LOW - 1
MEDIUM - 2
HIGH - 3

PROJECT OUTCOMES MAPPING PROGRAM OUTCOMES

PO PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PO12

P1 2

P2 3

P3 2

P4 2

PROJECT OUTCOMES MAPPING PROGRAM SPECIFIC OUTCOMES

PSO PSO1 PSO2

P1

2
P2
2
P3

P4

PROJECT OUTCOMES MAPPING PROGRAM EDUCATIONAL OBJECTIVES

PEO PEO1 PEO2 PEO3 PEO4

1 2
P1

2
P2

P3

P4
DECLARATION
We hereby declare that the project report entitled “PRODUCT RECOMMENDATION
SYSTEM” is done in the partial fulfillment for the award of the Degree in Bachelor of Technology
in Computer Science and Engineering affiliated to Jawaharlal Nehru Technological University,
Hyderabad. This project has not been submitted anywhere else.

V SRI DATTA YOGISHWAR(19BD1A051U)

ARTHAM ABHINAY (19BD1A0504)

GANDYADAPU SATWIK(19BD1A050L)

MALIPEDDI SAI TEJA(19BD1A0512)


ACKNOWLEDGMENT
We take this opportunity to thank all the people who have rendered their full supportto our project

work.

We render our thanks to Dr. Maheshwar Dutta, B.E., M Tech., Ph.D., Principal who encouraged us

to do the Project.

We are grateful to Mr. Neil Gogte, Director for facilitating all the amenities required for carrying out

this project.

We express our sincere gratitude to Mr. S. Nitin, Director and Dr. D. Jaya Prakash, Dean Academics

for providing an excellent environment in the college.

We are also thankful to Dr. S. Padmaja, Head of the Department for providing us with both time and

amenities to make this project a success within the given schedule.

We are also thankful to our guide AJEET KUMAR JAIN, for his/her valuable guidance and

encouragement given to us throughout the project work.

We would like to thank the entire CSE Department faculty, who helped us directlyand indirectly in

the completion of the project. We sincerely thank our friends and family for their constant motivation

during the project work.

V SRI DATTA YOGISHWAR(19BD1A051U)

ARTHAM ABHINAY (19BD1A0503)

GANDYADAPU SATWIK(19BD1A050L)

MALIPEDDI SAI TEJA(19BD1A0512)


CONTENT

DESCRIPTION PAGE NO.

ABSTRACT i
LIST OF FIGURES ii
LIST OF TABLES iii
CHAPTERS
1. INTRODUCTION 1-3
1.1. Purpose of the Project 2
1.2. Problem with the Existing System 2
1.3. Proposed System 2
1.4. Scope of the Project 2
1.5. Architecture Diagram 3
2. SOFTWARE REQUIREMENTSSPECIFICATIONS 4-7

2.1. Requirements Specification Document 5


2.2. Functional Requirements 6
2.3. Non-Functional Requirements 6
2.4. Software Requirements 7
2.5. Hardware Requirements 7
3. LITERATURE SURVEY 8-12
4. SYSTEM DESIGN 13-18
4.1. Introduction to UML 14
4.2. UML Diagrams 14
4.3. Use Case diagram 15
4.4. Sequence diagram 16

4.5. Class diagram 18


5. IMPLEMENTATION 19-27
5.1. Pseudo code 20
DESCRIPTION PAGE NO.

5.2. Code Snippets 21-29


6. TESTING 30-32
6.1. Introduction to Testing 31
6.2. Software Test Lifecycle 32
6.3. Test Cases 33
7. SCREENSHOTS 35-40
8.FURTHER ENHANCEMENTS 41-42
9.CONCLUSION 43-44
10.REFERENCES 45-46
ABSTRACT

Artificial Intelligence is a method of making a computer or software think intelligently like a human and
predict the required outcome. It is normally accompanied by studying the patterns of human brains in form
of neural networks analyzing the process. The outcome of these studies develop intelligent software and
systems. These systems are repeatedly iterated backwards and trained to get the required result on training
data. In Artificial Intelligence the computers are trained to learn without being explicitly programmed.
Computers are trained well on good set of data to achieve good accuracy.
With every day developing online business and stores, the usage of recommendation system has become
a significant part of E-commerce industry .An Artificial Intelligence recommendation system is a class of
Machine Learning algorithms used by developers to predict the users choices and offer relevant
suggestions. Algorithm used in recommendation system depends on purchases and page views done before.
For example if a user searches for a particular product on websites like Amazon or Movie on Netflix then
their product recommendation system recommends the product of same category and movies of same genre.
With use of recommendation systems the customers are able to find the items they are looking for easily
and quickly. This recommendation system is used as a excellent marketing tool to increase the sales and
increase revenue. Artificial Intelligence can be used to design product recommendation system.

KESHAV MEMORIAL INSTITUTE OF TECHNOLOGY i


LIST OF FIGURES

LIST OF FIGURES PAGE NO.

1.1 Architecture of Product Recommendation System Model 3

3.1 IEEE 829 test plan template 10

4.1 Use Case Diagram 15

4.2 Sequence Diagram 17

4.3 Class Diagram 18

7.1 import libraries 36

7.2 Load the dataset 36

7.3 Dropping the timestamp column 37

7.4 Taking subset of the data and handling missing values 37

7.5 Ratings 38

7.6 Taking the subset of dataset to make it less sparse/ denser. 38

7.7 Splitting the data 39

7.8 Building Popularity Recommendation Model 39

7.9 Building Collaborative Filtering recommendation Model 40

7.10 Evaluation of Collabrative recommendation model 40

KESHAV MEMORIAL INSTITUTE OF TECHNOLOGY ii


LIST OF TABLES

LIST OF TABLES PAGE NO.


3.7 Activities and Outcomes of each phase in SDLC 11-12
6.2.1 Valid User 33
6.2.2 Invalid User 34

KESHAV MEMORIAL INSTITUTE OF TECHNOLOGY iii


PRODUCT RECOMMENDATION SYSTEM

CHAPTER -1

KESHAV MEMORIAL INSTITUTE OF TECHNOLOGY 1


PRODUCT RECOMMENDATION SYSTEM

1. INTRODUCTION
Purpose of Project
Recommender systems are software tools and techniques providing suggestions for items to be of use to
a user. The term item here is generic. It may represent many concepts. For instance recommender systems
may recommend news on a news portal, or products in an online shop, or even services. The
recommendations are usually tailored to a given type of user or a given type of user group. Since
recommendations are personalized, they may vary from one user to another or from one user group to
another. If you have ever been on the Amazon web page (and we hope you have) browsing, or trying to
buy an item, you have probably seen recommender systems at work. In fact on the Amazon web page the
section “people who purchased this item also purchased...” is the list of items Amazon’s recommender
systems predicted you might be interested in. There are plenty of other web sites where you can watch
recommender system at work. Some examples are Google news, the yahoo portal, Pandora, Spotify,
Netflix, and so on.

Problems with Existing System


The suggestions before product recommendation system were without collaborative filtering and content
based filtering. Content based filtering methods are mainly based on description of an item and a profile
of users preferred choice.

Proposed System
A product recommendation is basically a filtering system that seeks to predict and show the items that a
user would like to purchase. It may not be entirely accurate, but if it shows you what you like then it is
doing its job right.

Scope of the Project


The objective of recommender systems is to provide recommendations based on recorded information on
the users' preferences. These systems use information filtering techniques to process information and
provide the user with potentially more relevant items.

KESHAV MEMORIAL INSTITUTE OF TECHNOLOGY 2


PRODUCT RECOMMENDATION SYSTEM

Architecture Diagram

Fig 1.1 – Architecture of Product Recommendation System Model

The following figure shows the underlying basic data layer. This layer contains user profile data, item
data, behavior data, and comment data. The user profile data may be users' heights and weights, items
they purchased, their purchase preferences, or their education background. The item data is the prices,
colors, and origins of items. If the item is a video, the item data is the information of the video such as the
video content and tags. The behavior data refers to the interaction between users and items. For example,
when a user watches a video, the user may add a like to the video, add the video to favorites, or pay for
the video. These actions are all the user's behavior data. The comment data may involve third-party data,
and may not be available for every item on every platform. However, the user data, the item data, and the
behavior data are essential. With the three types of data ready, we can move on to the data processing and
storage layer. In this layer, we can perform data processing, such as identifying user features, material
features, and event features. Going forward is modeling based on these features. As we have
aforementioned in the preceding section, the entire recommendation process contains two important
modules: matching and ranking. Multiple algorithms can run in parallel in the matching module.

KESHAV MEMORIAL INSTITUTE OF TECHNOLOGY 3


PRODUCT RECOMMENDATION SYSTEM

CHAPTER -2

KESHAV MEMORIAL INSTITUTE OF TECHNOLOGY 4


PRODUCT RECOMMENDATION SYSTEM

2. SYSTEM RERUIREMENT SPECIFICATIONS

What is SRS?

Software Requirement Specification (SRS) is the starting point of the softwaredeveloping activity. As system
grew more complex it became evident that the goal of the entire system cannot be easily comprehended.
Hence the need for the requirement phase arose. The software project is initiated by the client needs. The
SRS is the means of translating the ideas of the minds of clients (the input) into a formal document
(theoutput of the requirement phase.)

The SRS phase consists of two basic activities:

Problem/Requirement Analysis:

The process is order and more nebulous of the two, deals with understand the problem, the goal and
constraints.
Requirement Specification:

Here, the focus is on specifying what has been found giving analysis such as representation, specification
languages and tools, and checking the specifications are addressed during this activity.
The Requirement phase terminates with the production of the validate SRSdocument. Producing the SRS
document is the basic goal of this phase.

Role of SRS

The purpose of the Software Requirement Specification is to reduce the communication gap between the
clients and the developers. Software Requirement Specification is the medium though which the client
and user needs are accuratelyspecified. It forms the basis of software development. A good SRS should
satisfy all the parties involved in the system.
Requirements Specification Document

A Software Requirements Specification (SRS) is a document that describes the nature of a project, software
or application. In simple words, SRS document is a manual of a project provided it is prepared before
you kick-start a project/application. This

KESHAV MEMORIAL INSTITUTE OF TECHNOLOGY 5


PRODUCT RECOMMENDATION SYSTEM

document is also known by the names SRS report, software document. A software document is primarily
prepared for a project, software or any kind of application.

There are a set of guidelines to be followed while preparing the software requirement specification
document. This includes the purpose, scope, functional and non functional requirements, software and
hardware requirements of the project. Inaddition to this, it also contains the information about environmental
conditions required,safety and security requirements, software quality attributes of the project etc.
The purpose of SRS (Software Requirement Specification) document is to describethe external behaviour of
the application developed or software. It defines the operations, performance and interfaces and quality
assurance requirement of the application orsoftware. The complete software requirements for the system are
captured by the SRS. This section introduces the requirement specification document for Word Building
Gameusing Alexa which enlists functional as well as non-functional requirements.

Functional Requirements

For documenting the functional requirements, the set of functionalities supported by the system are to be
specified. A function can be specified by identifying the state at which data is to be input to the system, its
input data domain, the output domain, and the type of processing to be carried on the input data to obtain the
output data. Functional requirements define specific behaviour or function of the application. Following are
the functional requirements:
FR1) The most searched product or category is given as output.

FR2) The dataset should be fed to the system without any error or null values. FR3) Product frequency should
be correctly calculated.
FR4) The category should not be repeated.

Non-Functional Requirements

A non-functional requirement is a requirement that specifies criteria that can be usedto judge the operation
of a system, rather than specific behaviours. Especially these are the constraints the system must work
within. Following are the non-functionalrequirements:
NFR 1) Must be able to work on any s o f t w a r e
NFR 2) Should not be any lag in the output.
NFR 3) The recommendation system should be always available.

NFR 4) Should support multiple users at the same time in different locations.

KESHAV MEMORIAL INSTITUTE OF TECHNOLOGY 6


PRODUCT RECOMMENDATION SYSTEM

NFR 5)Internet connection is essential for the functioning of the smart speaker.

Performance:

The performance of the developed applications can be calculated by using following methods: Measuring
enables you to identify how the performance of your application stands in relation to your defined
performance goals and helps you to identify thebottlenecks that affect your application performance. It helps
you identify whether your application is moving toward or away from your performance goals. Defining
what you will measure, that is, your metrics, and defining the objectives for each metric is a critical part of
your testing plan.
Performance objectives include the following:

Response time, Latency throughput or Resource utilization.

Software Requirements

Operating System : Windows 10 or MAC OS.

Platform : Google Collab/Jupyter Notebook

Programming Language : Python

Hardware Requirements

Processor : Intel core i3 and above.

Hard Disk : 2 GB or above.

RAM : 2 GB or above.

Internet : 4 Mbps or above (Wireless).

KESHAV MEMORIAL INSTITUTE OF TECHNOLOGY 7


PRODUCT RECOMMENDATION SYSTEM

CHAPTER -3

KESHAV MEMORIAL INSTITUTE OF TECHNOLOGY 8


PRODUCT RECOMMENDATION SYSTEM

3. LITERATURE SURVEY

The process of testing a software in a well-planned and systematic way is known as software testing lifecycle
(STLC). Different organizations have different phasesin STLC however generic Software Test Life Cycle
(STLC) for waterfall development model consists of the following phases :

1. Requirements Analysis

2. Test Planning

3. Test Analysis

4. Test Design

5. Test Construction and Verification

6. Test Execution and Bug Reporting

7. Final Testing and Implementation

8. Post Implementation

Requirements Analysis

In this phase testers analyse the customer requirements and work with developers during the design phase to
see which requirements are testable and how they are going to test those requirements. It is very important to
start testing activities from the requirements phase itself because the cost of fixing defect is very less if it is
found in requirements phase rather than in future phases. In this phase all the planning about testing is done
like what needs to be tested, how the testing will be done, test strategy to be followed, what will be the test
environment, what test methodologies will be followed, hardware and software availability, resources, risks
etc. A high level test plan document is created which includes all the planning inputs mentioned above and
circulated to the stakeholders.
Usually IEEE 829 test plan template is used for test planning.

KESHAV MEMORIAL INSTITUTE OF TECHNOLOGY 9


PRODUCT RECOMMENDATION SYSTEM

Fig 3.1 - IEEE 829 test plan template

Test Analysis

After test planning phase is over test analysis phase starts, in this phase we need to dig deeper into project
and figure out what testing needs to be carried out in each SDLC phase. Automation activities are also
decided in this phase, if automation needs to be done for software product, how will the automation be done,
how much time will it take to automate and which features need to be automated. Non functional testing
areas (Stress and performance testing) are also analysed and defined in this phase.

Test Design

In this phase various black-box and white-box test design techniques are used to design the test cases for
testing, testers start writing test cases by following those design

KESHAV MEMORIAL INSTITUTE OF TECHNOLOGY 10


PRODUCT RECOMMENDATION SYSTEM

techniques, if automation testing needs to be done then automation scripts also needs to written in this phase.

Test Construction and Verification

In this phase testers prepare more test cases by keeping in mind the positive and negative scenarios, end user
scenarios etc. All the test cases and automation scripts need to be completed in this phase and got reviewed
by the stakeholders. The test plan document should also be finalized and verified by reviewers.

Test Execution and Bug Reporting

Once the unit testing is done by the developers and test team gets the test build, The test cases are executed
and defects are reported in bug tracking tool, after the test execution is complete and all the defects are
reported. Test execution reports are created and circulated to project stakeholders. After developers fix the
bugs raised by testers theygive another build with fixes to testers, testers do re-testing and regression testing
to ensure that the defect has been fixed and not affected any other areas of software. Testing is an iterative
process i.e. If defect is found and fixed, testing needs to be done after every defect fix. After tester assures
that defects have been fixed and no more critical defects remain in software the build is given for final testing.

Final Testing and Implementation

In this phase the final testing is done for the software, non functional testing like stress, load and performance
testing are performed in this phase. The software is also verified in the production kind of environment. Final
test execution reports and documents are prepared in this phase.

Post Implementation

In this phase the test environment is cleaned up and restored to default state, the process review meetings are
done and lessons learnt are documented. A document is prepared to cope up similar problems in future
releases.

Phase Activities Outcome

KESHAV MEMORIAL INSTITUTE OF TECHNOLOGY 11


PRODUCT RECOMMENDATION SYSTEM

Create high level test plan Test plan, Refined Specification


Planning

Revised Test Plan, Functional Validation Matrix,


Create detailed test plan,
Analysis test cases
Functional

Validation Matrix, test

cases
Test cases are revised, select Revised test cases, testdata sets,
Design which test casesto automate risk

assessment sheet.

Test procedures/Scripts,
Scripting of test cases to Drivers, test
Construction automate results, Bug reports

Complete testing Test results, Bug


Testing cycles
cycles reports
Execute remaining stress and
Test results anddifferent metrics ontest efforts
performancetests, complete
Final testing documentation

Evaluate testing Plan for improvement


Post
Implementation processes of testing process

Table 3.7 – Activities and Outcomes of each phase in SDLC

KESHAV MEMORIAL INSTITUTE OF TECHNOLOGY 12


PRODUCT RECOMMENDATION SYSTEM

CHAPTER -4

KESHAV MEMORIAL INSTITUTE OF TECHNOLOGY 13


PRODUCT RECOMMENDATION SYSTEM

4. SYSTEM DESIGN

Introduction to UML

The Unified Modeling Language allows the software engineer to express an analysis model using the
modeling notation that is governed by a set of syntactic, semantic and pragmatic rules. A UML system is
represented using five different views that describe the system from distinctly different perspective. Each
view is defined by a set of diagram, which is as follows:
1. User Model View

This view represents the system from the users’ perspective. The analysis representation describes a
usage scenario from the end-users’ perspective.
2. Structural Model View

In this model, the data and functionality are arrived from inside the system. This model view models
the static structures.
3. Behavioural Model View

It represents the dynamic of behavioural as parts of the system, depicting he interactions of collection
between various structural elements described in the user model and structural model view.
4. Implementation Model View

In this view, the structural and behavioural as parts of the system are represented as they are to be
built.
5. Environmental Model View

In this view, the structural and behavioural aspects of the environment in which the system is to be
implemented are represented.

UML Diagrams
Use Case Diagram

To model a system, the most important aspect is to capture the dynamic behaviour. To clarify a bit in
details, dynamic behaviour means the behaviour of the system when it is running/operating.

KESHAV MEMORIAL INSTITUTE OF TECHNOLOGY 14


PRODUCT RECOMMENDATION SYSTEM

So only static behaviour is not sufficient to model a system rather dynamic behaviour is more important
than static behaviour. In UML there are five diagrams available to model dynamic nature and use case
diagram is one of them. Now as we have to discuss that the use case diagram is dynamic in nature there
should be some internal or external factors for making the interaction.
These internal and external agents are known as actors. So use case diagrams are consisting of actors, use
cases and their relationships. The diagram is used to model the system/subsystem of an application. A
single use case diagram captures a particular functionality of a system. So to model the entire system
numbers of use case diagramsare used.
Use case diagrams are used to gather the requirements of a system including internal and external
influences. These requirements are mostly design requirements. So when a system is analysed to gather
its functionalities use cases are prepared and actors are identified. In brief, the purposes of use case
diagrams can be as follows:
a. Used to gather requirements of a system.

b. Used to get an outside view of a system.

c. Identify external and internal factors influencing the system.

d. Show the interacting among the requirements are actors.

Fig 4.1 – Use Case Diagram

KESHAV MEMORIAL INSTITUTE OF TECHNOLOGY 15


PRODUCT RECOMMENDATION SYSTEM

Sequence Diagram

Sequence diagrams describe interactions among classes in terms of an exchange of messages over time.
They're also called event diagrams. A sequence diagram is a good way to visualize and validate various
runtime scenarios. These can help to predict how a system will behave and to discover responsibilities a
class may need to have in the process of modelling a new system.
The aim of a sequence diagram is to define event sequences, which would have a desired outcome. The
focus is more on the order in which messages occur than on the message per se. However, the majority
of sequence diagrams will communicate what messagesare sent and the order in which they tend to
occur.
Basic Sequence Diagram NotationsClass Roles or Participants

Class roles describe the way an object will behave in context. Use the UMLobject symbol to illustrate
class roles, but don't list object attributes.
Activation or Execution Occurrence

Activation boxes represent the time an object needs to complete a task. When an object is busy executing
a process or waiting for a reply message, use a thin grey rectangle placed vertically on its lifeline.
Messages

Messages are arrows that represent communication between objects. Use half-
arrowed lines to represent asynchronous messages.
Asynchronous messages are sent from an object that will not wait for a responsefrom
the receiver before continuing its tasks.

Lifelines are vertical dashed lines that indicate the object's presence over time.
Lifelines

Destroying Objects

Objects can be terminated early using an arrow labelled "<< destroy >>" that points to an X. This object
is removed from memory. When that object's lifeline ends, you can place an X at the end of its lifeline to
denote a destructionoccurrence.

KESHAV MEMORIAL INSTITUTE OF TECHNOLOGY 16


PRODUCT RECOMMENDATION SYSTEM

Loops

A repetition or loop within a sequence diagram is depicted as a rectangle. Place the


condition for exiting the loop at the bottom left corner in square brackets []. Guards

When modelling object interactions, there will be times when a condition must be met for
a message to be sent to an object. Guards are conditions that need to be used throughout
UML diagrams to control flow.

Fig 4.2– Sequence Diagram

KESHAV MEMORIAL INSTITUTE OF TECHNOLOGY 17


PRODUCT RECOMMENDATION SYSTEM

Class Diagram

Class diagrams are the main building blocks of every object oriented methods. The class diagram can be
used to show the classes, relationships, interface, association, and collaboration. UML is standardized in
class diagrams. Since classes are the building block of an application that is based on OOPs, so as the
class diagram has appropriate structure to represent the classes, inheritance, relationships, and everything
that OOPs have in its context. It describes various kinds of objects and the static relationship in between
them.
The main purpose to use class diagrams are:

1. This is the only UML which can appropriately depict various aspects of OOPsconcept.

2. Proper design and analysis of application can be faster and efficient.

3. It is base for deployment and component diagram.

Each class is represented by a rectangle having a subdivision of threecompartment sname, attributes and
operation.

Fig 4.3–Class Diagram

KESHAV MEMORIAL INSTITUTE OF TECHNOLOGY 18


PRODUCT RECOMMENDATION SYSTEM

CHAPTER -5

KESHAV MEMORIAL INSTITUTE OF TECHNOLOGY 19


PRODUCT RECOMMENDATION SYSTEM

5. IMPLEMENTATION

Pseudo Code:

Step 1: Import the required packages.

Step 2: Load the dataset and add the headers.

Step 3: If the dataset is large consider a portion of the dataset.

Step 4: Handle the missing values in dataset

Step 5: Take the subset of dataset to make it less sparser or denser.

Step 6: Split the Data into training data and testing data.

Step 7: Build Popularity recommendation model based on the sorted values of data according to the
reviews given by customers.

Step 8: Build the collaborative filtering recommendation model.

Step 9: Use Single Valued decomposition algorithm to minimize the dimensions of the data.

Step 10: Evaluate the collaborative recommendation model.

Step 11 : Use different test cases and run the model.

KESHAV MEMORIAL INSTITUTE OF TECHNOLOGY 20


PRODUCT RECOMMENDATION SYSTEM

Code Snippets

1. model.py

# 1. Import the libraries


# Commented out IPython magic to ensure Python compatibility.
#import the reqired libraries
from IPython.core.interactiveshell import InteractiveShell
InteractiveShell.ast_node_interactivity = "all"
import numpy as np
import pandas as pd
import math
import json
import time
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.metrics.pairwise import cosine_similarity
from sklearn.model_selection import train_test_split
from sklearn.neighbors import NearestNeighbors
import joblib
import scipy.sparse
from scipy.sparse import csr_matrix
from scipy.sparse.linalg import svds
import warnings; warnings.simplefilter('ignore')
from google.colab import drive
drive.mount('/content/drive/')
%matplotlib inline

# 2. Load the dataset and add headers

# Import the dataset and give the column names

KESHAV MEMORIAL INSTITUTE OF TECHNOLOGY 21


PRODUCT RECOMMENDATION SYSTEM

columns=['userId', 'productId', 'ratings','timestamp']


electronics_df=pd.read_csv('/content/drive/My Drive/Colab
Notebooks/ratings_Electronics.csv',encoding= 'unicode_escape',names=columns)
electronics_df.head()
"""#### Dropping the timestamp column"""
electronics_df.drop('timestamp',axis=1,inplace=True)
electronics_df.info()
#Check the number of rows and columns
rows,columns=electronics_df.shape
print('Number of rows: ',rows)
print('Number of columns: ',columns)
#Check the datatypes
electronics_df.dtypes
#Taking subset of the dataset
electronics_df1=electronics_df.iloc[:50000,0:]

"""* Since the data is very big. Consider electronics_df1 named dataframe with first 50000 rows and all
columns from 0 of dataset."""
electronics_df1.info()

#Summary statistics of rating variable


electronics_df1['ratings'].describe().transpose()

#Find the minimum and maximum ratings


print('Minimum rating is: %d' %(electronics_df1.ratings.min()))
print('Maximum rating is: %d' %(electronics_df1.ratings.max()))

"""* Rating are on the scale 1 to 5.

# Handling Missing values


"""
#Check for missing values

KESHAV MEMORIAL INSTITUTE OF TECHNOLOGY 22


PRODUCT RECOMMENDATION SYSTEM

print('Number of missing values across columns: \n',electronics_df.isnull().sum())

"""* There are no missing records in the dataset.


## Ratings
"""
# Check the distribution of the rating
with sns.axes_style('white'):
g = sns.factorplot("ratings", data=electronics_df1, aspect=2.0,kind='count')
g.set_ylabels("Total number of ratings")

"""* We can see that more number of users have given the rating of 5.

## Users and products


"""
# Number of unique user id in the data
print('Number of unique users in Raw data = ', electronics_df1['userId'].nunique())
# Number of unique product id in the data
print('Number of unique product in Raw data = ', electronics_df1['productId'].nunique())

"""# 3. Taking the subset of dataset to make it less sparse/ denser."""

#Check the top 10 users based on ratings


most_rated=electronics_df1.groupby('userId').size().sort_values(ascending=False)[:10]
print('Top 10 users based on ratings: \n',most_rated)

counts=electronics_df1.userId.value_counts()
electronics_df1_final=electronics_df1[electronics_df1.userId.isin(counts[counts>=15].index)]
print('Number of users who have rated 25 or more items =', len(electronics_df1_final))
print('Number of unique users in the final data = ', electronics_df1_final['userId'].nunique())
print('Number of unique products in the final data = ', electronics_df1_final['userId'].nunique())

"""* electronics_df1_final has the users who have rated 25 or more items.

KESHAV MEMORIAL INSTITUTE OF TECHNOLOGY 23


PRODUCT RECOMMENDATION SYSTEM

## ratings analysis in final dataset


"""

#constructing the pivot table


final_ratings_matrix = electronics_df1_final.pivot(index = 'userId', columns ='productId', values =
'ratings').fillna(0)
final_ratings_matrix.head()

"""* It shows that it is a sparse matrix. So, many cells are filled with 0 values."""

print('Shape of final_ratings_matrix: ', final_ratings_matrix.shape)

"""* We can see that there are 7 products and 236 users."""

#Calucating the density of the rating marix


given_num_of_ratings = np.count_nonzero(final_ratings_matrix)
print('given_num_of_ratings = ', given_num_of_ratings)
possible_num_of_ratings = final_ratings_matrix.shape[0] * final_ratings_matrix.shape[1]
print('possible_num_of_ratings = ', possible_num_of_ratings)
density = (given_num_of_ratings/possible_num_of_ratings)
density *= 100
print ('density: {:4.2f}%'.format(density))

"""* The density value of the matrix also shows that it is a sparse matrix.

# 4. Splitting the data


"""

#Split the data randomnly into train and test datasets into 70:30 ratio
train_data, test_data = train_test_split(electronics_df1_final, test_size = 0.3, random_state=0)
train_data.head()

print('Shape of training data: ',train_data.shape)

KESHAV MEMORIAL INSTITUTE OF TECHNOLOGY 24


PRODUCT RECOMMENDATION SYSTEM

print('Shape of testing data: ',test_data.shape)

"""# 5. Building Popularity Recommder model"""

#Count of user_id for each unique product as recommendation score


train_data_grouped = train_data.groupby('productId').agg({'userId': 'count'}).reset_index()
train_data_grouped.rename(columns = {'userId': 'score'},inplace=True)
train_data_grouped.head(40)

#Sort the products on recommendation score


train_data_sort = train_data_grouped.sort_values(['score', 'productId'], ascending = [0,1])

#Generate a recommendation rank based upon score


train_data_sort['rank'] = train_data_sort['score'].rank(ascending=0, method='first')

#Get the top 5 recommendations


popularity_recommendations = train_data_sort.head(5)
popularity_recommendations

# Use popularity based recommender model to make predictions


def recommend(user_id):
user_recommendations = popularity_recommendations

#Add user_id column for which the recommendations are being generated
user_recommendations['userId'] = user_id

#Bring user_id column to the front


cols = user_recommendations.columns.tolist()
cols = cols[-1:] + cols[:-1]
user_recommendations = user_recommendations[cols]

return user_recommendations

KESHAV MEMORIAL INSTITUTE OF TECHNOLOGY 25


PRODUCT RECOMMENDATION SYSTEM

find_recom = [10,100,150] # This list is user choice.


for i in find_recom:
print("The list of recommendations for the userId: %d\n" %(i))
print(recommend(i))
print("\n")

"""* Since, it is a Popularity recommender model, so, all the three users are given the same
recommendations. Here, we predict the products based on the popularity. It is not personalized to
particular user. It is a non-personalized recommender system.

# 6. Building Collaborative Filtering recommender model.


"""

electronics_df_CF = pd.concat([train_data, test_data]).reset_index()


electronics_df_CF.head()

"""## User Based Collaborative Filtering model"""

# Matrix with row per 'user' and column per 'item'


pivot_df = electronics_df_CF.pivot(index = 'userId', columns ='productId', values = 'ratings').fillna(0)
pivot_df.head()

print('Shape of the pivot table: ', pivot_df.shape)

#define user index from 0 to 10


pivot_df['user_index'] = np.arange(0, pivot_df.shape[0], 1)
pivot_df.head()

pivot_df.set_index(['user_index'], inplace=True)
# Actual ratings given by users
pivot_df.head()

"""* As this is a sparse matrix we will use SVD.

KESHAV MEMORIAL INSTITUTE OF TECHNOLOGY 26


PRODUCT RECOMMENDATION SYSTEM

### Singular Value Decomposition


"""
# Singular Value Decomposition
U, sigma, Vt = svds(pivot_df, k = 10)

from google.colab import drive


drive.mount('/content/drive')

print('Left singular matrix: \n',U)

print('Sigma: \n',sigma)

"""* As sigma is not a diagonal matrix we have to convert it into diagonal matrix."""

# Construct diagonal array in SVD


sigma = np.diag(sigma)
print('Diagonal matrix: \n',sigma)

print('Right singular matrix: \n',Vt)

#Predicted ratings
all_user_predicted_ratings = np.dot(np.dot(U, sigma), Vt)
# Convert predicted ratings to dataframe
preds_df = pd.DataFrame(all_user_predicted_ratings, columns = pivot_df.columns)
preds_df.head()

# Recommend the items with the highest predicted ratings

def recommend_items(userID, pivot_df, preds_df, num_recommendations):


# index starts at 0
user_idx = userID-1
# Get and sort the user's ratings

KESHAV MEMORIAL INSTITUTE OF TECHNOLOGY 27


PRODUCT RECOMMENDATION SYSTEM

sorted_user_ratings = pivot_df.iloc[user_idx].sort_values(ascending=False)
#sorted_user_ratings
sorted_user_predictions = preds_df.iloc[user_idx].sort_values(ascending=False)
#sorted_user_predictions
temp = pd.concat([sorted_user_ratings, sorted_user_predictions], axis=1)
temp.index.name = 'Recommended Items'
temp.columns = ['user_ratings', 'user_predictions']
temp = temp.loc[temp.user_ratings == 0]
temp = temp.sort_values('user_predictions', ascending=False)
print('\nBelow are the recommended items for user(user_id = {}):\n'.format(userID))
print(temp.head(num_recommendations))

userID = 4
num_recommendations = 5
recommend_items(userID, pivot_df, preds_df, num_recommendations)

userID = 6
num_recommendations = 5
recommend_items(userID, pivot_df, preds_df, num_recommendations)

userID = 8
num_recommendations = 5
recommend_items(userID, pivot_df, preds_df, num_recommendations)

"""* Since, it is a Collaborative recommender model, so, all the three users are given different
recommendations based on users past behaviour.

# 7. Evaluation of Collabrative recommendation model


"""

# Actual ratings given by the users


final_ratings_matrix.head()

KESHAV MEMORIAL INSTITUTE OF TECHNOLOGY 28


PRODUCT RECOMMENDATION SYSTEM

# Average ACTUAL rating for each item


final_ratings_matrix.mean().head()

# Predicted ratings
preds_df.head()

# Average PREDICTED rating for each item


preds_df.mean().head()

rmse_df = pd.concat([final_ratings_matrix.mean(), preds_df.mean()], axis=1)


rmse_df.columns = ['Avg_actual_ratings', 'Avg_predicted_ratings']
print(rmse_df.shape)
rmse_df['item_index'] = np.arange(0, rmse_df.shape[0], 1)
rmse_df.head()

RMSE = round((((rmse_df.Avg_actual_ratings - rmse_df.Avg_predicted_ratings) ** 2).mean() ** 0.5),


5)
print('\nRMSE SVD Model = {} \n'.format(RMSE))

"""# 8. Getting top - K ( K = 5) recommendations. """

# Enter 'userID' and 'num_recommendations' for the user #


userID = 9
num_recommendations = 5
recommend_items(userID, pivot_df, preds_df, num_recommendations)

KESHAV MEMORIAL INSTITUTE OF TECHNOLOGY 29


PRODUCT RECOMMENDATION SYSTEM

CHAPTER -6

KESHAV MEMORIAL INSTITUTE OF TECHNOLOGY 30


PRODUCT RECOMMENDATION SYSTEM

6. TESTING
Introduction to Testing

Testing is the process of evaluating a system or its component(s) with the intent to find whether it satisfies
the specified requirements or not. Testing is executing a systemin order to identify any gaps, errors, or
missing requirements in contrary to the actual requirements.

According to ANSI/IEEE 1059 standard, Testing can be defined as - A process of analyzing a software
item to detect the differences between existing and required conditions (that is defects/errors/bugs) and to
evaluate the features of the software item.

Who does Testing?

It depends on the process and the associated stakeholders of the project(s). In the IT industry, large
companies have a team with responsibilities to evaluate the developed software in context of the given
requirements. Moreover, developers also conduct testing which is called Unit Testing. In most cases, the
following professionals are involved in testing a system within their respective capacities:

● Software Tester

● Software Developer

● Project Lead/Manager

● End User

Levels of testing include different methodologies that can be used while conductingsoftware testing. The
main levels of software testing are:

● Functional Testing

● Non-functional Testing

Functional Testing

This is a type of black-box testing that is based on the specifications of the software that is to be tested.
The application is tested by providing input and then the results are examined that need to conform to the
functionality it was intended for. Functional testing of a software is conducted on a complete, integrated
system to evaluate the system's compliance with its specified requirements.

KESHAV MEMORIAL INSTITUTE OF TECHNOLOGY 31


PRODUCT RECOMMENDATION SYSTEM

Software Testing Life Cycle

The process of testing a software in a well planned and systematic way is known assoftware testing
lifecycle (STLC).
Different organizations have different phases in STLC however generic Software Test Life Cycle (STLC)
for waterfall development model consists of the following phases.

1. Requirements Analysis

2. Test Planning

3. Test Analysis

4. Test Design

● Requirements Analysis

In this phase testers analyze the customer requirements and work with developers during the design
phase to see which requirements are testable and how they are going to test those requirements.
It is very important to start testing activities from the requirements phase itself because the cost of
fixing defect is very less if it is found in requirements phase rather than in future phases.

● Test Planning

In this phase all the planning about testing is done like what needs to be tested, how the testing will be
done, test strategy to be followed, what will be the test environment, what test methodologies will be
followed, hardware and software availability, resources, risks etc. A high level test plan document is
created whichincludes all the planning inputs mentioned above and circulated to the stakeholders.

● Test Analysis

After test planning phase is over test analysis phase starts, in this phase we needto dig deeper into
project and figure out what testing needs to be carried out in each SDLC phase. Automation activities
are also decided in this phase, ifautomation needs to be done for software product, how will the
automation be

KESHAV MEMORIAL INSTITUTE OF TECHNOLOGY 32


PRODUCT RECOMMENDATION SYSTEM

done, how much time will it take to automate and which features need to be automated. Non functional
testing areas(Stress and performance testing) are also analyzed and defined in this phase.

● Test Design

In this phase various black-box and white-box test design techniques are used to design the test cases for
testing, testers start writing test cases by following those design techniques, if automation testing needs
to be done then automation scripts also needs to written in this phase.

Test Cases

● The word uttered must start with the same character as the end of the previousword.

● The words must not be repeated in the game.

● The length of the word must be greater than or equal to three.

Table 6.2.1: Valid User

Test User ID Test Case User-1A


ScenarioID ID

Test Case Registered User ID Entry Test High


Description Priority

Pre- Valid User Post NA


Requisite Requisite

Test Execution Steps:

S.No Action Input Expected Actual Output Test Test Comments


Output Result

1. Enters User ID 3 B00004RIPE B00004RIPE Pass NA


and Number of B00004TH2W B00004TH2W

Recommendati B00000J061 B00000J061


ons B00003WGP5 B00003WGP5

B00004RERZ B00004RERZ

KESHAV MEMORIAL INSTITUTE OF TECHNOLOGY 33


PRODUCT RECOMMENDATION SYSTEM

Table 6.2.2: Invalid User

Test User ID Test Case User-1A


ScenarioID ID

Test Case Registered User ID Entry Test High


Description Priority

Pre- Valid User Post NA


Requisite Requisite

Test Execution Steps:

S.No Action Input Expected Actual Output Test Test Comments


Output Result

1 Enters User ID 3 B00004RIPE B00004RIPE Pass NA


and Number of B00004TH2W B00004TH2W

Recommendati B00000J061 B00000J061


ons B00003WGP5 B00003WGP5

B00004RERZ B00004RERZ

KESHAV MEMORIAL INSTITUTE OF TECHNOLOGY 34


PRODUCT RECOMMENDATION SYSTEM

CHAPTER -7

KESHAV MEMORIAL INSTITUTE OF TECHNOLOGY 35


PRODUCT RECOMMENDATION SYSTEM

7. SCREENSHOTS
1. Import the Libraries

Fig 7.1 – import libraries

2. Load the dataset and add headers

Fig 7.2 - Load the dataset

KESHAV MEMORIAL INSTITUTE OF TECHNOLOGY 36


PRODUCT RECOMMENDATION SYSTEM

3.Dropping the Timestamp column

Fig 7.3 – Dropping the timestamp column

4.Taking subset of the data and handling missing values

Fig 7.4 - Taking subset of the data and handling missing values

KESHAV MEMORIAL INSTITUTE OF TECHNOLOGY 37


PRODUCT RECOMMENDATION SYSTEM

5. Ratings

Fig 7.5 – Ratings

6.Taking the subset of dataset to make it less sparse/ denser.

Fig 7.6 - Taking the subset of dataset to make it less sparse/ denser.

KESHAV MEMORIAL INSTITUTE OF TECHNOLOGY 38


PRODUCT RECOMMENDATION SYSTEM

7. Splitting the data

Fig 7.7 - Splitting the data

8.Building Popularity Recommendation Model

Fig 7.8 - Building Popularity Recommendation Model

KESHAV MEMORIAL INSTITUTE OF TECHNOLOGY 39


PRODUCT RECOMMENDATION SYSTEM

9.Building Collaborative Filtering recommendation Model

Fig 7.9 - Building Collaborative Filtering recommendation Model

10. Evaluation of Collabrative recommendation mode

Fig 7.10 - Building Collaborative Filtering recommendation Model

KESHAV MEMORIAL INSTITUTE OF TECHNOLOGY 40


PRODUCT RECOMMENDATION SYSTEM

CHAPTER -8

KESHAV MEMORIAL INSTITUTE OF TECHNOLOGY 41


PRODUCT RECOMMENDATION SYSTEM

8. FUTURE ENHANCEMENTS

There are some significant changes which can be brought to the existing model. Although the
performance of the recommender system is good and it will detect the Products which can be promoted
using Recommender system but still there could be more accuracy which can be used in order to
detect the products.

KESHAV MEMORIAL INSTITUTE OF TECHNOLOGY 42


PRODUCT RECOMMENDATION SYSTEM

CHAPTER -9

KESHAV MEMORIAL INSTITUTE OF TECHNOLOGY 43


PRODUCT RECOMMENDATION SYSTEM

9. CONCLUSION

The Popularity-based recommender system is a non-personalised recommender system and these are
based on frequecy counts, which may be not suitable to the user.We can see the differance above for the
user id 4, 6 & 8, The Popularity based model has recommended the same set of 5 products to both but
Collaborative Filtering based model has recommended entire different list based on the user past purchase
history.

Model-based Collaborative Filtering is a personalised recommender system, the recommendations are


based on the past behavior of the user and it is not dependent on any additional information.

Implementing a product recommendation system is definitely worth all the potential difficulties and
challenges. And here are three reasons to prove this statement.
1. Improved user experience
2. Increased sales
3. Higher retention rate

KESHAV MEMORIAL INSTITUTE OF TECHNOLOGY 44


PRODUCT RECOMMENDATION SYSTEM

CHAPTER -10

KESHAV MEMORIAL INSTITUTE OF TECHNOLOGY 45


PRODUCT RECOMMENDATION SYSTEM

10. REFERENCES

• Wikipedia Recommender system. URL: https://en.wikipedia.org/wiki/Recommender_system .


Accessed May 31, 2019.Boehner, K, et al., 2007. How emotion is made and measured. International
Journal of Human-Computer Studies, 65(4), pp.275--291.
• Bullington, J., 2005. 'Affective' computing and emotion recognition systems: thefuture of biometric
surveillance? In Proceedings of the 2nd annual conference on Information security curriculum
development (pp. 95-99). ACM.
• Caridakis, G, et al., 2006. Modelling naturalistic affective states via facial and vocal expressions
recognition. pp.146--154.
• Devi, M, Phore, M, Kumari, P, 2013. Mind Reading Computers. International Journal of Advanced
Research in Computer Engineering & Technology, 2(12).
• Dhall, A and Goecke, R, 2012. Group Expression Intensity Estimation in Videos via Gaussian
Processes. Proceedings of the International Conference on Pattern Recognition ICPR2012, Tsukuba,
Japan, 11-15 Nov 2012.
• www.ijert.org/research/mind-reading-computer-IJERTCONV5IS03069

• Dhall, A, Goecke, R, Lucey, S and Gedeon, T, 2011. Acted Facial Expressions in the Wild Database.
Technical Report TR-CS-11-02, Research School of Computer Science, Australian National
University, September 2011.
• El Kaliouby, R, 2005. ‘Mind-Reading Machines: automated Inference of Complex Mental States’,
doctoral dissertation, University of Cambridge.
• www.ijcat.com/archives/volume3/issue8/ijcatr03081004

• El Kaliouby, R & Robinson, P, 2004. Mind reading machines: Automated inference ofcognitive mental
states from video. In Systems, Man and Cybernetics, 2004 IEEE International Conference on (Vol. 1,
pp. 682-688). IEEE.
• El Kaliouby, R, Picard, R. and Baron-Cohen, S, 2006. Affective Computing and Autism. Annals of the
New York Academy of Sciences, 1093(1), pp.228-248.
• Futuristic Head Band, 2012, ’Various models of the futuristic headband’ http://catchupdates.com/wp-
content/uploads/2012/05/Futuristic-headband.jpg 1Khan, S, 2014. Mind Reading Computer.
International Journal of Computer Science and Mobile Computing. Vol. 3, Issue, 6. pp. 558-564.

• Ma, X, Wang, R and Liang, J, 2008. The e-learning system model based on affectivecomputing. pp.
54-56.

KESHAV MEMORIAL INSTITUTE OF TECHNOLOGY 46

You might also like