0% found this document useful (0 votes)
115 views37 pages

Capstone Review-3

The document describes a critique based movie recommender system created by students Pranayan Saha and Suryansh Agarwal as a partial fulfillment for their Bachelor of Technology degree. The system uses collaborative filtering, user reviews, and clustering algorithms like K-Means to provide personalized movie recommendations to users and help reduce information overload. It allows users to provide their opinions on movies, suggest other movies, and see recommendations and ratings in a highly visualized manner. The system provides a single platform for these features where previous approaches used separate platforms. The application architecture is designed for easy scalability with loose coupling.

Uploaded by

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

Capstone Review-3

The document describes a critique based movie recommender system created by students Pranayan Saha and Suryansh Agarwal as a partial fulfillment for their Bachelor of Technology degree. The system uses collaborative filtering, user reviews, and clustering algorithms like K-Means to provide personalized movie recommendations to users and help reduce information overload. It allows users to provide their opinions on movies, suggest other movies, and see recommendations and ratings in a highly visualized manner. The system provides a single platform for these features where previous approaches used separate platforms. The application architecture is designed for easy scalability with loose coupling.

Uploaded by

pranayan saha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 37

CRITIQUE BASED MOVIE RECOMMENDER SYSTEM

Submitted in partial fulfillment of the requirements for the degree of

Bachelor of Technology
in
Computer Science and Engineering

By

Name:Suryansh Agarwal Name:Pranayan Saha


Reg No.:18BCE0858 Reg No.:18BCE0890
Mobile No.: 6377031201 Mobile No.:8787558176

Under the guidance of

Prof. / Dr. Ruby D.


SCOPE
VIT, Vellore.

June, 2022
DECLARATION

I hereby declare that the thesis entitled “Critique Based Movie Recommender System" submitted
by Pranayan Saha(18BCE0890) and Suryansh Agarwal(18BCE0858), for the award of the
degree of Bachelor of Technology in Computer Science and Engineering to VIT is a record of
bonafide work carried out by me under the supervision of Dr.Ruby D.

I further declare that the work reported in this thesis has not been submitted and will not be
submitted, either in part or in full, for the award of any other degree or diploma in this institute
or any other institute or university.

Place : Vellore
Date :

Signature of the Candidate


CERTIFICATE

This is to certify that the thesis entitled “Critique Based Movie Recommender System”
submitted by Pranayan Saha(18BCE0890) and Suryansh Agarwal(18BCE0858), SCOPE, VIT
University, for the award of the degree of Bachelor of Technology in Computer Science and
Engineering, is a record of bonafide work carried out by them under my supervision,Dr.Ruby D
during the period, 03.01.2022 to 30.05.2022, as per the VIT code of academic and research
ethics.

The contents of this report have not been submitted and will not be submitted either in part or in
full, for the award of any other degree or diploma in this institute or any other institute or
university. The thesis fulfills the requirements and regulations of the University and in my
opinion meets the necessary standards for submission.

Place : Vellore
Date :

Signature of the Guide

Internal Examiner External Examiner

Head of the Department


Computer Science and Engineering
ACKNOWLEDGEMENTS

It is my pleasure to express with deep sense of gratitude to Dr. Ruby D, Assistant Prof. Sr.
Grade 1, SCOPE, Vellore Institute of Technology, for her constant guidance, continual
encouragement, understanding, more than all, she taught me patience in my endeavor. My
association with her is not confined to academics only, but it is a great opportunity on my part to
work with an intellectual and expert in the field of Computer Science and Engineering.

I would like to express my gratitude to the Chancellor, VPs, VC, PRO-VC, Dean, Dr. Ramesh
Babu K SCOPE, for providing an environment to work in and for his inspiration during the
tenure of the course.

In jubilant mood I express ingeniously my whole-hearted thanks to HOD, Dr. Vairamuthu S,


SCOPE, all teaching staff and members working as members of our university for their
not-self-centered enthusiasm coupled with timely encouragement showered on me with zeal,
which prompted the acquisition of the requisite knowledge to finalize my course study
successfully. I would like to thank my parents for their support.

It is indeed a pleasure to thank my friends who persuaded and encouraged me to take up and
complete this task. Last but not least, I express my gratitude and appreciation to all those who
have helped me directly or indirectly toward the successful completion of this project.

Place : Vellore SURYANSH AGARWAL (18BCE0858)

Date : PRANAYAN SAHA (18BCE0890)

i
EXECUTIVE SUMMARY

Every time we go online, we are overwhelmed by the amount of choices we have. Information is
presented at a rate too fast a person can process. This overwhelming information can take the
user to the state of Information Overload. It is a state of having too much information to make a
choice or remain informed about a topic. Currently we are having systems that recommend
content based on the popularity, downloads, stability, etc. Problem with these systems is that they
are generalised to the public and not to a particular user.

We propose a critique based recommender system that uses Collaborative Filtering, User Content
and Clustering Algorithms like K-Means or Gaussian Mixture Models to provide personalised
recommendations to the user to decrease their information load. Users can also give their own
opinion about a movie and they can also suggest movies. A highly visualised result helps users in
understanding the ratings better. The earlier approaches provided separate platforms for all these
things but we have provided a one stop platform to access all the features. The application will
be loosely coupled making it easily scalable.

ii
CONTENTS Page No.

Acknowledgement i
Executive Summary ii
List of Figures iii
List of Tables iv
List of Abbreviations v
1 INTRODUCTION 1-2
1.1 Objective
1.2 Motivation
1.3 Background

2 PROJECT DESCRIPTION AND GOALS 2-3

3 TECHNICAL SPECIFICATION 3-4

4 DESIGN APPROACH AND DETAILS (as applicable) . 4-12


4.1 Design Approach(System architecture)
4.2 System Design
4.3 Methodology
4.4 Constraints, Alternatives and Tradeoffs

5 PROJECT DEMONSTRATION 13-18

6 RESULT & DISCUSSION (as applicable) . 18-19


6.1Comparative Result Analysis

7 CONCLUSION AND FUTURE WORK(SUMMARY) 19-20

8 REFERENCES 20-21

APPENDIX 21-28
List of Figures

Figure No. Title Page No.

4.1 System Architecture 4


5.1 Login/signup page 13
5.2 User Registration Page 13
5.3 Login page 14
5.4 Home page 14
5.5 Movies Search Results 15
5.6 Movie Description 15
5.7 Comment Section 16
5.8 Recommendation page 16
5.9 User info stored in MongoDB 17
5.10 Reviews stored in MongoDB 17
5.11 User history in MongoDB 18

iii
List of Tables

Table No. Title Page No.

1.1 System Feature 1 5


1.2 System Feature 2 6
1.3 System Feature 3 7
1.4 System Feature 4 8
1.5 System Feature 5 8
1.6 System Feature 6 9
1.7 System Feature 7 9

iv
List of Abbreviations

RS Recommender Systems
CF Collaborative Filtering
NLP Natural Language Processing
TF-IDF Term Frequency – Inverse Document Frequency
HTTP HyperText Transfer Protocol
GUI Graphic User Interface

v
1.INTRODUCTION:

1.1.OBJECTIVE:

We will be successfully designing a Movie Recommendation program where the user will be
able to sign in and receive preferences recommendations, and can provide updates and ratings on
any movie using collaborative filtering and sentiment analysis.

The main objectives of the Movie recommender system are as follows:


1. Enable user to recommend movies
2. Not only does the user benefit but it also provides a rating that helps other users as well.
3. Provide a way for the user to provide feedback and ratings for movies.
4. Finding movies at high rates.
5. Not recommending a movie that the user does not expect to watch.

1.2.MOTIVATION:

Movies are made for people and therefore its success should primarily be measured by how it
was received by the audience. The Internet has made it so much easier for us to connect to
different kinds of people with varying choices and reading their views on the movies definitely
helps in forming an opinion. But reading reviews in bulk is a very tedious task and our critique
system helps in reducing the effort by analysing the reviews and using various natural language
processing and machine learning algorithms for overall sentiment analysis of the movie. It gives
a straightforward positive or negative sentiment and does not lead to any confusion for the users.

1.3.BACKGROUND:

There are enough ML models that are some kind of algorithm threatened with Flask, and that's a
real problem.

Users use a browser that uses only Javascript, HTML, and CSS. That's ahead. It can make calls
to the recurring server to get results, which when processed and displayed. The back server

1
should respond ASAP to previous requests; but the backend may need to talk to details,
third-party APIs, and microservices. The backend can also display slower tasks - such as ML
tasks - at the user's request, which they should add to the queue. If you think the user usually
verifies it in some way. The whole process gets a little weaker when we count more users
because while one user is doing his ML model predicts something the other has to wait in line for
his application to be processed. Therefore processes - such as ML types - which are problems,
should be freely connected to a large server. This practice comes with price, request time and
response time, but that is small considering the time it takes for modeling processes.

Our two background requests are undone. Now let's say we have some functionality that
produces slow operations, we can unplug it from the main server and use its own back. Now
each instance should always be legal: finish managing the HTTP request and exit. Do not keep
anything in memory between applications, because the first client request may go to one server,
and then the next application to another.

Flask server receives requests from nodejs server. Wrapped in JSON. The application is then
processed with a flash - in our case which can be a compliment or an emotional engine,
depending on the URL - while the waiting signal is sent to node js. After that Node JS is free to
serve other users. This reduces the load on a large server. When the task is complete the
download returns a promise with a JSON response.

2.PROJECT DESCRIPTION AND GOALS

The Movie critique program is intended to allow users to view and provide movie reviews / ratings,
visualize various movie features to solicit interesting information about them and is in a position to
predict whether the movie could be a hit / flop. and developed a recommendation system. The
Recommendation System can be a program that requires guessing or a preferred filter that matches
the user's preferences. Recommendation systems used in local time include movies, music, news,
books, research articles, search queries, social tags and products in general. Recommendation
programs generate a list of recommendations in any of these two ways: -

2
• Collaborative filtering: Collaborative filtering methods form a model based on previous user
behavior (e.g. items purchased or searched by the user) and similar decisions made by other users.
This model is used to predict items (or product ratings) that users may be interested in.
• Content-based filtering: Content-based filtering methods use a series of abstract object elements
to recommend additional objects with similar properties. Content-based filtering methods are based
entirely on the description 5 of the item and profile of user preferences. Recommends items based
on previous user preferences.

We will be successfully designing a Movie Recommendation program where the user will be able
to sign in and receive preferences recommendations, and can provide updates and ratings on any
movie using collaborative filtering and sentiment analysis. Recommendations are made after
collecting(explicitly or implicitly), processing, and analysing user or object data. However,
performing the RS is a manual and labour-intensive task, due to the apparent quantity of available
data to be processed. A fast-paced version of the movie will also be provided for those who are
thinking about the plot seriously before watching the film.

3.TECHNICAL SPECIFICATION

3.1 System Requirements


3.1.1 Hardware Requirements

The following hardware requirements should be met for the software to


work in a computing environment-
● Intel Pentium or processor with minimum speed 2.10GHz
● Minimum 1GB RAM
● Minimum capacity of 500MB (Hard Disk)
● A displaying monitor
● Accelerated graphics card
● Better performance with 250MB and above cache memory
● Modem or wi-fi for internet connectivity

3
3.1.2 Software Requirements

The following software requirements need to be met for actuating the


application within the system-
● Any operating system with GUI compatible
● Browser for accessing the website
● Anaconda for building a custom environment
● Visual Studio Code for building the website

4.DESIGN APPROACH AND DETAILS


4.1.DESIGN APPROACH

Fig 4.1.System Architecture.

4
4.2. SYSTEM DESIGN

4.2.1.Recommendation Engine:
The recommendation system provides a movie recommendation platform for users. The
recommendation program analyzes users' activities, movie preferences and offers
suggestions.Recommendations are often viewed as a two-pronged approach (usually people and
artifacts, such as movies and books) and are read in domains that focus on online information
resources, data integration, social decision-making systems, and user interaction.
Recommendation systems use user information, item, and ratings to predict how other users will
like a particular item.We will use the Collaborative Recommender program for this project to
analyze user preferences and recommend movies accordingly.
Purpose : Recommend movies to the users.

Input : User’s preferences of movies, user’s watching history, Users searching history, other
user’s preferences of movies.
Processing : A collaborative filtering algorithm will be trained on the input data and predict most
likely movies.
Output : The result will be a rundown of top 10 preferences of movies.

a) Getting at least top 5 picks of movies from the user.

User Action System Action

1)Select Movies

The choices are fetched from the database

2)Click save

The choices are stored in the database.


Table 1.1

b) Recommended Movies are suggested to users.

5
User Action System Action

Press the button to recommend.

The algorithm recommends movie from the


database.

The movies are shown in a sorted movie


preferences.
Table 1.2

4.2.2. Critique Engine:


The critique system predicts the fate of the movies by analyzing the reviews and comments about
the movies. The user registered with the site to review or comment about the movies they
watched. Our critique framework will anticipate the future decision of the films by getting
setting from the sentiments of individuals. It will provide the complete analysis of the reviews
made in favor and against the movie.This Critique system will only depend on the user`s reviews
and comments and will not be altered or adulterated by the critic reviews. The prediction model
for the framework is ready by the cutting edge design in NLP and deep learning.The expectation
of the critique engine will be either hit or failure based on a certain threshold. The threshold will
be refreshed naturally as the model is prepared in the end. This is a unique feature because all the
movies are judged by the ratings and the comments of the people. Our model will fill in the holes
impeccably.

Purpose : Predict whether a movie is a hit or flop, shows complete analysis of reviews.

Input : All the reviews made about a particular movie, comments about a movie Processing : A
NLP and deep learning model will process the reviews and returns probabilistic results

Output : The Output will be the analysis of all the reviews and prediction of the movie
(HIT/FLOP).

6
a) Movie prediction/Critique

User Action System Action

1) Enter Movie Name

2) Click predict

The NLP model will run on all the


reviews mapped to that movie on the
server side.

Model returns complete predicted


data the client side.

Data is displayed on the Client side.


Table 1.3
4.2.3 .Movie Info Provider
This is the most informative page of our website and a crucial requirement of our system.The
fundamental reason for this page is to show total insights concerning a specific film. The data
goes from the cast of the film to the plot and trailer of the film. The site page will be a very much
organized and efficient voyager of any film of decision.

This page will give everything about having some familiarity with the film and won't really think
about a user researching about the film's subtleties. The principal motivation behind this page is
to give total subtleties to film buffs.

Purpose : The object is to serve the crowd with complete insights regarding a specific film.
Input : the info will be a film id or film name or user reaction on film
Processing : The movie data is fetched from the internet and saved in the
database.
Output : Complete insight concerning the film egs: plot, cast, trailer and so forth.

7
a) Select movie from predefined lists

User action System action

1) Select the thumbnail

The movie data is fetched from the


database

The link to the trailer for the movie is


open.

Information is sent on the client side


as displayed.

Table 1.4

b) Search for a movie whose information is needed.

User action System action

1) Enter movie name in the search


bar

2) Click on search button

The movie data is fetched from the


database

The link to the trailer for the movie is


open.

Information is sent on the client side


as displayed
Table 1.5

8
4.2.4. Login/Signup page
This page includes typical enlisting and verification of user's. The login will be utilized to allow
clients to users different services of the site. The signup will allow new users to register in our
database.

This functionality is required because for every website to strive forward it needs customers or
users. More the user, the more the popularity among people and websites will be ruling the
charts.
Purpose : To allow users to enlist to the site.
Input : Usernames, Emails, Passwords, other details, O-auth details
Processing : The input data is validated by the format expected,
authentication, securing the data.
Output : Confirmation message, authentication message

a) New user signup

User Actions System Actions

1) Enter details

The data is validated synchronously

2)Press sign up

The details are stored in the database.


Table 1.6
b) User login

User Actions System Actions

1) Enter credentials

2) Press login

Data is validated

If true direct to the home page


Table 1.7

9
4.3 .METHODOLOGY
4.3.1.Memory Based Collaborative Filtering
Memory-based methods use client rating authentic information to figure the comparability
between clients or things. The thought behind these techniques is to characterize a similitude
measure between clients or things, and view them as the most likely to suggest concealed things.
There are 2 primary sorts of memory-based collaborative filtering algorithms: User-Based and
Item-Based.

4.3.1.2.User-Based
Here we find clients that have seen/rated comparative content, and utilize their inclinations to
suggest new things. We will describe each of the steps below.
4.3.1.2.1.Get User-Item Rating Data:This data is mostly stored in a matrix format. It is called
the User-Item Matrix. Let’s assume that there exist m users in our system and n movies.
Whenever we really want to store client thing rating information, we need a matrix with some
specification.
● m rows, where each row addresses a client.
● n columns, where every column addresses a film.

4.3.1.2.2.Create User-User Similarity Matrix: With user-item matrix, we will calculate the
similarity measure between different users using Pearson Correlation. Pearson Correlation is
quite a common way of finding the similarity in recommendation systems.

4.3.1.2.3.Look Up Similar Users: After calculating the whole user-user matrix, we will find the
list of the most similar users to our target user(0<Similarity score <1).
4.3.1.2.4.Generate Movie Items: Now we have similar users. First, let's start with the most
similar user to our target user. Whatever movie our target user has not watched in that genre, we
will try to predict the rating of that movie using the prediction formula.

10
4.3.1.2.5.Rank Movies:For this step, we will rank the movies according to their prediction
without considering anything else. The highest prediction gets the highest rank, lowest prediction
gets the lowest rank.

4.3.1.2.6.Filter Movies: Out of all possible candidates, we would take the highest 10 of them
and show to the target user as the recommendations.

4.3.2.Sentiment Analysis :
Sentiment analysis of a movie review can rate how positive or negative a movie review is and
hence the overall rating for a movie. Therefore, the process of understanding if a review is
positive or negative can be automated as the machine learns through training and testing the data.

4.3.2.1.Pre-processing data: In this process, we convert the text to lowercase for CSV data and
remove unnecessary space and breaks.

4.3.2.2.Text vectorization: In this process,we convert the text into numerical representation.We
will use a TF-IDF model to define the importance of each word depending on how frequent it is
in the text. As a result, a high TF-IDF score for a word will indicate that this word is specific to
this text.

4.3.2.3.Modeling using Multinomial Naive Bayes: After splitting and vectorize text reviews
into numbers, we will generate a Multinomial Naive Bayes model on the training set. This
classification algorithm tends to be a baseline solution for sentiment analysis task. The basic idea
of Naive Bayes technique is to find the probabilities of classes assigned to texts by using the

joint probabilities of words and classes.

11
4.4.CONSTRAINTS, ALTERNATIVES AND TRADEOFFS

1. Movie ratings should be integers between 1 to 5

2. Only keywords related to movies will fetch results

3. The site will automatically logout once closed .

4. Movies are added to the dataset through backend services.

5. Dataset used for recommendation of movies is from Kaggle , so it is limited to 100,000


movies up till now .

6. Omdbapi is used for getting movie info .

7. RAM allocated to the Recommendation engine is 1GB , so it will run slow on computers with
very less RAM .

12
5.PROJECT DEMONSTRATION

Fig 5.1:This is the login/signup page. Users can click on the register button to make a new
account or they can login from an existing account

Fig 5.2:This is the registration page. Users can make a new account.

13
Fig 5.3:The users can login from their registered username and password, once registered.

Fig 5.4:This is the home page. Users can search for any movie by name.

14
Fig 5.5:This page displays the movies according to the user’s search.

Fig 5.6:This page gives the complete info about the specific movie including the description and
ratings. The users can click on the ‘Give Review’ button to give their review on the ‘Check
Reviews’ button to check the reviews.

15
Fig 5.7:The review gets added and is displayed on this page. It also gives the sentiments on the
basis of the comments.

Fig 5.8:This page shows the recommendation to the user as per their previous searches and
reviews.

16
Fig 5.9: Documents of the registered group members in the “users” collection

17
Fig 5.10: Two movie reviews in the “reviews” collection with the given fields along with
sentiment detected for recommendation purposes

Fig 5.11: Two movies with given fields along with movie reviewer details in the “movies”
collection

6.RESULT AND DISCUSSION


We have made a fully functional Movie Recommender System which will help the user to select
movies based on his/her choice. The user can give a rating(out of 5) and comment on the movie.
Then on the basis of rating and comments given by the user, our sentiment analysis model will
remark that comment either as ‘Positive Review’ or a ‘Negative Review’. Users are given a site
to filter films by year, by choice of filmstars and then type them at will.This feature is usually
available by asking the existing database to meet the user's needs. A fast-paced version of this
will make our site more interactive and user friendly.
6.1Comparative Result Analysis
1.Cold-start problem: It presents a collective issue of new item and new user to RS. A new
item can’t be recommended initially when it is introduced to a CF system with no ratings. As

18
earlier discussed about the cold start problem, MovieLens (movielens.org) cannot recommend
new movies until these have got some initial ratings. So,in our case ,we introduced the imdb
rating parameter to cover up this problem.

2. Accuracy: We have used the training set which includes 7000 Comments and their polarity set
as 0 and 1 for sentiment analysis. The accuracy for the sentiment analysis using multinomial
naive bayes model came to be as 98.30 which is higher than in general score.

3.Scalability Problem: One vital and foremost issue of RSs today is the scalability of algorithms
with large real-world datasets. It is becoming challenging to deal with huge and dynamic data
sets produced by item-users interactions such as preferences, ratings and reviews. It is
conceivable that when some recommendation algorithms are applied on moderately small data
sets, they give the best outcomes, yet may reflect wasteful or most horrendously terrible conduct
on extremely enormous datasets.

4.Sparse RSs: Generally, majority of the users do not rate most of the items and consequently
the ratings matrix becomes very sparse.Because of this, the data sparsity issue emerges that
declines the possibilities tracking down a bunch of users with comparative ratings. This is the
most famous disadvantage of this CF strategy. This concern can be lightened by utilizing some
extra space data..

7.CONCLUSIONS AND FUTURE WORK(SUMMARY)

The Movie Recommendation program is successfully designed where the user is able to sign and
receive preferences recommendations, and can provide updates and ratings on any movie.
Recommendations are made after collecting (explicitly or implicitly), processing, and analyzing
user or object data. However, performing the RS is a manual and labor-intensive task, due to the
apparent quantity of available data to be processed. Another way to simplify the collection of
needs, and as a result the development of RS, is a standard user description and object model that
can adapt to any domain. This study describes a systematic review whose purpose is to identify
all user and material information used in current and used RS.

19
There are a small number of RS with shared filters, which may indicate that a comparison of user
profile or user history details has not been adequately investigated. Privacy concerns about user
information may explain this effect. Easy access to real data seems to be a key thing about this
result, as we've access to rich information, like MovieLens.

The results presented in this work can be expanded, including more details on new case studies
with different technologies. Another major change in computer science that should be relevant in
this context is the emergence of Big Data, which has very large databases, data that has several
structures, and is constantly evolving. It can change how user and object data is modeled, and
more importantly, how information is collected from users and objects in demand engineering.

8.REFERENCES
● Chirag Malik, ‘Recommending Movies Using User-Based and Item-Based Collaborative
Filtering on R Platform’ , International Journal of Business Analytics & Intelligence
(IJBAI), 2019.
● Anwar Tausif, Uma V. , ‘Comparative study of recommender system approaches and movie
recommendation using collaborative filtering’ ,International Journal of Systems Assurance
Engineering & Management , Springer Nature, 2021.
● Al-Ghurabi S.M. , Mohd Noah S.A. , ‘Multi-Criteria Review-Based Recommender
System–The State of the Art’ , IEEE Access Access, IEEE. 7:169446-169468 2019; USA:
IEEE Language: English, Database: IEEE Xplore Digital Library ,2019
● Roy Debashish, Ding Chen , ‘Multi-source based movie recommendation with ratings and
the side information’ , Social Network Analysis & Mining , Vol. 11 Issue 1, Springer Nature.
, 2021.
● Sejwal V.K., Abulaish M, Jahiruddin, ‘CRecSys: A Context-Based Recommender System
Using Collaborative Filtering and LOD’, IEEE, Database: IEEE Xplore Digital Library,
2020.
● Hu Yutian , Xiong Fei, Lu Dongyuan,Wang Ximeng, Xiong Xi, Chen Hongshu, ‘Movie
collaborative filtering with multiplex implicit feedbacks’, Neurocomputing, Elsevier B.V. ,
2020.

20
● A survey of attack detection approaches in collaborative filtering recommender systems
written by Rezaimehr Fatemeh, Dadkhah Chitra, published on March 2021
● Adaptable and proficient Hellinger Coefficient Based Collaborative Filtering for
recommendation system written by Maheswari, M. Geetha, S. ,Selva kumar S published
on 2019
● Joint Neural Collaborative Filtering for Recommender Systems written by Wanyu Chen
,Fei Cai,Honghui Chen,Maarten De Rijke published on 14 August 2019-

● Analyzing emotion based movie recommender system using fuzzy emotion features written
by Mala Saraswat,Shampa Chakraverty, Atreya Kala published on 1 February 2020
● Social movie recommender system based on deep autoencoder network using Twitter data
written by Hossein Tahmasebi, Reza Ravanmehr, Rezvan Mohammad Rezaei published
on 16 June 2020
● Efficient Machine Learning Model for Movie Recommender Systems Using Multi-Cloud
Environment written by K. Indira1 & M. K. Kavithadevi published on 16 October 2019
WebLinks
● https://medium.com/recommendation-systems/how-user-based-collaborative-filtering-wo
rks-netflix-movie-recommendation-simulation-96f0c40fae21

● https://www.analyticsvidhya.com/blog/2021/07/performing-sentiment-analysis-with-naiv
e-bayes-classifier/

● https://medium.com/nerd-for-tech/the-open-movie-database-omdb-for-fetch-movie-data-
bc5ff46bec8
API Links
● http://www.omdbapi.com/apikey.aspx.

21
APPENDIX

sentiment_analysis.py→
import pandas as pd
import numpy as np
import nltk
from nltk.corpus import stopwords
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.model_selection import train_test_split
from sklearn import naive_bayes
from sklearn.metrics import roc_auc_score,accuracy_score
import pickle

nltk.download("stopwords")

dataset = pd.read_csv('data/reviews.txt',sep = '\t', names


=['Reviews','Comments'])

stopset = set(stopwords.words('english'))

vectorizer = TfidfVectorizer(use_idf = True,lowercase = True,


strip_accents='ascii',stop_words=stopset)

X = vectorizer.fit_transform(dataset.Comments)
y = dataset.Reviews
pickle.dump(vectorizer, open('transform.pkl', 'wb'))

X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.20,


random_state=42)

clf = naive_bayes.MultinomialNB()
clf.fit(X_train,y_train)

# accuracy_score(y_test,clf.predict(X_test))*100

22
clf = naive_bayes.MultinomialNB()
clf.fit(X,y)

# accuracy_score(y_test,clf.predict(X_test))*100

filename = 'nlp_model.pkl'
pickle.dump(clf, open(filename, 'wb'))

App.py→
from flask import Flask, request, jsonify, render_template, url_for,
redirect
import urllib.request
import pandas as pd
import numpy as np
import pickle
import json

# Init app
app = Flask(__name__, static_url_path='/static')

@app.route('/movies/recommend', methods=['POST'])
def recommend():
# user_movies = [("Amazing Spider-Man, The (2012)",5),("Mission:
Impossible III (2006)",4),("Toy Story 3 (2010)",2),("2 Fast 2 Furious
(Fast and the Furious 2, The) (2003)",4)]
# user_movies = [("Heat (1995)",3)]
# user_movies1 = []

user_imdbid = request.json['user_movies']

# print(user_movies)

ratings = pd.read_csv('data/ratings.csv')
movies = pd.read_csv('data/movies.csv')

23
links = pd.read_csv('data/links.csv')
ratings = pd.merge(movies,ratings).drop(['genres','timestamp'],axis=1)
links = pd.merge(links,movies)
ratings.head()

# user_imdbid = [['tt0848228', 4], ['tt4154756', 3], ['tt2395427', 4]]

user_movies = []

for x in user_imdbid:
movie_title = links.loc[links['imdbId'] == int(x[0][2:]),
'title'].item()
movie_params = (movie_title,x[1])
user_movies.append(movie_params)

# print(user_movies)

user_ratings =
ratings.pivot_table(index=['userId'],columns=['title'],values='rating')
user_ratings.head()

user_ratings = user_ratings.dropna(thresh=10,axis=1).fillna(0)
user_ratings.head()

item_similarity_df = user_ratings.corr(method='pearson')
item_similarity_df.head()

def get_similar_movies(movie_name,user_rating):
similar_score = item_similarity_df[movie_name]*(user_rating-2.5)
similar_score = similar_score.sort_values(ascending=False)

return similar_score

# user_movies = [("Amazing Spider-Man, The (2012)",5),("Mission:


Impossible III (2006)",4),("Toy Story 3 (2010)",2),("2 Fast 2 Furious
(Fast and the Furious 2, The) (2003)",4)]

24
similar_movies = pd.DataFrame()

for movie,rating in user_movies:


similar_movies =
similar_movies.append(get_similar_movies(movie,rating),ignore_index=True)

# print(similar_movies.head(10))

recommendations =
similar_movies.sum().sort_values(ascending=False).head(12)
# print(recommendations)
user_loved_movies = []

for movie, rating in user_movies:


user_loved_movies.append(movie)
print(user_loved_movies)
recommended_movies = []

for movie,rating in recommendations.to_dict().items():


if movie not in user_loved_movies:
# print(movie)
imdb_id = str(links.loc[links['title'] == movie,
'imdbId'].item()).zfill(7)
print(imdb_id)

json_obj=urllib.request.urlopen('http://www.omdbapi.com/?i=tt{}&apikey=136
adff'.format(imdb_id))
if(json_obj):
data = json.load(json_obj)
recommended_movies.append(data)

# recommended_movies.append(imdb_id)

print(recommended_movies)

25
return json.dumps(recommended_movies)

@app.route('/movies/sentiment', methods=['POST'])
def sentiment():

clf = pickle.load(open('nlp_model.pkl', 'rb'))


vectorizer = pickle.load(open('transform.pkl','rb'))

user_review = request.json['review']
movie_review_list = np.array([user_review])
movie_vector = vectorizer.transform(movie_review_list)
pred = clf.predict(movie_vector)
recommend.append(genre,imdb_rating)

review_sentiment = {
'review': user_review,
'sentiment': 'Positive Review' if pred[0] else 'Negative Review'
}

return json.dumps(review_sentiment)

@app.route("/visualization",methods=['GET','POST'])
def hello():
if request.method=='GET':
return
redirect(url_for('static',filename='visualization/hello.html'))

# Run Server
if __name__ == '__main__':
app.run(debug=True)

App.js
const path = require('path');

26
const express = require('express');

const chalk = require('chalk');

const bodyParser = require('body-parser');

const app = express();

const mongoose = require('mongoose');


const passport = require('passport');

const LocalStrategy = require('passport-local');

const methodOverride = require('method-override');

const User = require('./models/user');

const indexRoutes = require('./routes/index');

const movieRoutes = require('./routes/movies');

const connectDB = require('./config/db');

const dotenv = require('dotenv');

// App Config
dotenv.config();

app.set('view engine', 'ejs');

app.use(bodyParser.urlencoded({extended: true}));

app.use(express.static(path.join(__dirname,"public")));

app.use(methodOverride('_method'));

27
connectDB();

// Passport Config
app.use(require('express-session')({
secret: "Hail Hitler",
resave: false,
saveUninitialized: false
}));
app.use(passport.initialize());
app.use(passport.session());

passport.use(new LocalStrategy(User.authenticate()));

passport.serializeUser(User.serializeUser());

passport.deserializeUser(User.deserializeUser());

app.use(function(req,res,next){
res.locals.currentUser = req.user;
next();
});

// Routes
app.use('/',indexRoutes);

app.use('/',movieRoutes);

app.listen(process.env.PORT, () => {
console.log(chalk.bgGreen(`server running on port
${process.env.PORT}...`));
});

28

You might also like