AYASKANTA PARIDA - Report
AYASKANTA PARIDA - Report
AYASKANTA PARIDA - Report
USING
MACHINE LEARNING LIBRARIES
Ayaskanta Parida
Regd No. – 1901289071
June 2023
Figure 24 : File Structure
USING
MACHINE LEARNING LIBRARIES
Bachelor of Technology
in
Computer Science and Engineering
Submitted by
AYASKANTA PARIDA
Regd no.- 1901289071
Under the Guidance of
Dr. Subhra Swetanisha
Asst. Professor, Dept. of CSE
CERTIFICATE OF APPROVAL
Hyaskonta Poccda
Place: Bhubaneswar Ayaskanta Parida
Date : 25" June 2023 Regd No : 1901289071
ACKNOWLEDGEMENT
Itake this opportunity to express my gratitude to the people who
have been instrumental in the successful completion of this project. I am, in the
first place, obliged and grateful to my parents without whose support and care
Icould not have completed this project. I express my deep gratitude towards
my guide, Dr. Subhra Swetanisha, Associate Professor, Dept. of CSE,
Trident Academy of Technology, Bhubaneswar, for his tremendous support,
encouragement and help.
Place: Bhubaneswar
Ayaskonta Pari do
Ayaskanta Parida
Date: 25th June 2023 Regd No:1901289071
ABSTRACT
CERTIFICATE OF APPROVAL
CONTENTS
Sl Page no.
No Topic
.
1 INTRODUCTION 1-3
2 WHAT IS MACHINE LEARNING (ML) ? 3-5
17 WEBPAGE 101-103
18 APPLICATIONS 103-104
19 ADVANTAGES 104-105
INTRODUCTION:
In today's digital age, the availability of vast amounts of data and the
proliferation of streaming platforms have led to an overwhelming number of movies being
produced and made accessible to viewers. However, this abundance of choices can also make
it challenging for users to find movies that align with their preferences. Movie recommender
systems offer a solution to this problem by leveraging data analysis and machine learning
techniques to provide personalized movie recommendations to users. The entertainment
industry has undergone a significant transformation with the advent of streaming platforms and
the proliferation of online content. With an extensive library of movies and TV shows available
at their fingertips, viewers are faced with an overwhelming array of choices. However, the
challenge lies in finding content that aligns with their personal preferences and interests. Movie
recommender systems have emerged as a solution to this problem by leveraging data analysis
and machine learning techniques to provide personalized movie recommendations to users.
Movie recommender systems have gained tremendous importance in the streaming industry,
offering numerous benefits for both users and content providers. For users, these systems
enhance their overall viewing experience by helping them discover movies that cater to their
unique tastes and preferences.
The primary goal of a movie recommender system is to bridge the gap between users and the
ever-expanding world of movies. By understanding user preferences, these systems aim to
curate a tailored selection of movies that align with individual tastes, ensuring that users
discover relevant content they are likely to enjoy. This personalized approach not only saves
users time and effort in searching for movies but also introduces them to new titles, genres, and
filmmakers they may not have previously considered. The development of a movie
recommender system involves several key components and methodologies. These include data
collection, where user preferences, movie metadata, and historical interactions are gathered;
preprocessing, which involves cleaning and transforming the data into a suitable format for
analysis; feature extraction, where relevant movie and user features are identified; and the
utilization of various recommendation algorithms, such as collaborative filtering, content-
based filtering, and hybrid approaches, to generate accurate and diverse movie
Page | 1
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
recommendations. Despite their undeniable benefits, movie recommender systems also face
challenges. Scalability is another concern, as recommender systems must handle vast amounts
of data and ensure real-time recommendations even as the user base grows. Additionally, the
sparsity of user ratings and interactions for many movies can hinder the system's ability to
provide precise recommendations. Furthermore, maintaining diversity and avoiding the over-
recommendation of popular choices pose additional challenges for these systems. By
delivering personalized recommendations, users can explore new genres, discover hidden
gems, and avoid spending time on content that doesn't resonate with them. This personalized
approach leads to increased user satisfaction, engagement, and retention on streaming
platforms. From the perspective of content providers, movie recommender systems offer a
powerful tool to promote and showcase their offerings to a broader audience. By understanding
users' viewing habits, preferences, and interests, content providers can strategically recommend
movies to enhance discoverability and drive user engagement.
Page | 2
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
Page | 3
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
Page | 4
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
• Neural networks: Neural networks simulate the way the human brain works, with a
huge number of linked processing nodes. Neural networks are good at recognizing
patterns and play an important role in applications including natural language translation,
image recognition, speech recognition, and image creation.
• Linear regression: This algorithm is used to predict numerical values, based on a
linear relationship between different values. For example, the technique could be used to
predict house prices based on historical data for the area.
• Logistic regression: This supervised learning algorithm makes predictions for
categorical response variables, such as“yes/no” answers to questions. It can be used for
applications such as classifying spam and quality control on a production line.
• Clustering: Using unsupervised learning, clustering algorithms can identify patterns
in data so that it can be grouped. Computers can help data scientists by identifying
differences between data items that humans have overlooked.
Page | 5
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
• Decision trees: Decision trees can be used for both predicting numerical values
(regression) and classifying data into categories. Decision trees use a branching sequence
of linked decisions that can be represented with a tree diagram. One of the advantages of
decision trees is that they are easy to validate and audit, unlike the black box of the neural
network.
• Random forests: In a random forest, the machine learning algorithm predicts a value
or category by combining the results from a number of decision trees.
Here are just a few examples of machine learning you might encounter every day:
As machine learning technology has developed, it has certainly made our lives easier.
However, implementing machine learning in businesses has also raised a number of ethical
concerns about AI technologies. Some of these include:
• Technological singularity
While this topic garners a lot of public attention, many researchers are not concerned
with the idea of AI surpassing human intelligence in the near future. Technological singularity
is also referred to as strong AI or superintelligence. Philosopher Nick Bostrum defines
superintelligence as “any intellect that vastly outperforms the best human brains in practically
every field, including scientific creativity, general wisdom, and social skills.” Despite the fact
that superintelligence is not imminent in society, the idea of it raises some interesting
questions as we consider the use of autonomous systems, like self-driving cars. It’s unrealistic
to think that a driverless car would never have an accident, but who is responsible and liable
under those circumstances? Should we still develop autonomous vehicles, or do we limit this
technology to semi-autonomous vehicles which help people drive safely? The jury is still out
on this, but these are the types of ethical debates that are occurring as new, innovative AI
technology develops.
Page | 7
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
• AI impact on jobs
While a lot of public perception of artificial intelligence centers around job losses, this
concern should probably be reframed. With every disruptive, new technology, we see that the
market demand for specific job roles shifts. For example, when we look at the automotive
industry, many manufacturers, like GM, are shifting to focus on electric vehicle production
to align with green initiatives. The energy industry isn’t going away, but the source of energy
is shifting from a fuel economy to an electric one. In a similar way, artificial intelligence will
shift the demand for jobs to other areas. There will need to be individuals to help manage AI
systems. There will still need to be people to address more complex problems within the
industries that are most likely to be affected by job demand shifts, such as customer service.
The biggest challenge with artificial intelligence and its effect on the job market will be
helping people to transition to new roles that are in demand.
• Privacy
Privacy tends to be discussed in the context of data privacy, data protection, and
data security. These concerns have allowed policymakers to make more strides in recent
years. For example, in 2016, GDPR legislation was created to protect the personal data of
people in the European Union and European Economic Area, giving individuals more control
of their data. In the United States, individual states are developing policies, such as the
California Consumer Privacy Act (CCPA), which was introduced in 2018 and requires
businesses to inform consumers about the collection of their data. Legislation such as this has
forced companies to rethink how they store and use personally identifiable information (PII).
As a result, investments in security have become an increasing priority for businesses as they
seek to eliminate any vulnerabilities and opportunities for surveillance, hacking, and
cyberattacks.
biased human processes? While companies typically have good intentions for their
automation efforts, Reuters (link resides outside IBM) ) highlights some of the unforeseen
consequences of incorporating AI into hiring practices. In their effort to automate and simplify
a process, Amazon unintentionally discriminated against job candidates by gender for
technical roles, and the company ultimately had to scrap the project. Harvard Business
Review (link resides outside IBM) has raised other pointed questions about the use of AI in
hiring practices, such as what data you should be able to use when evaluating a candidate for
a role.
Bias and discrimination aren’t limited to the human resources function either; they
can be found in a number of applications from facial recognition software to social media
algorithms. As businesses become more aware of the risks with AI, they’ve also become
more active in this discussion around AI ethics and values. For example, IBM has sunset its
general purpose facial recognition and analysis products. IBM CEO Arvind Krishna wrote:
“IBM firmly opposes and will not condone uses of any technology, including facial
recognition technology offered by other vendors, for mass surveillance, racial profiling,
violations of basic human rights and freedoms, or any purpose which is not consistent with
our values and Principles of Trust and Transparency.”
• Accountability
Page | 9
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
DEFINITION OF LEARNING:
Definition:
A computer program is said to learn from experience E with respect to some class of
tasks T and performance measure P, if its performance at tasks T, as measured by P,
improves with experience E.
Another Definition
Examples
Page | 10
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
classifications.
AI VS ML VS DEEP LEARNING:
SL.NO ARTIFICIAL MACHINE DEEP
INTELLIGENCE LEARNING LEARNING
(AI) (ML) (DL)
Page | 12
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
4. Search Trees and much If you have a clear idea If you are clear about the
complex math is involved about the logic(math) math involved in it but
in AI. involved in behind andyou don’t have idea about
can visualize thecomplex the features ,so you
functionalities like break the
K- complex functionalities
Mean, Support Vector into linear/lower
Machines, etc., then it dimension features by
defines the ML aspect. adding more
layers, then it defines
the DL aspect.
Page | 13
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
Page | 14
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
The nearly limitless quantity of available data, affordable data storage, and
growth of less expensive and more powerful processing has propelled the growth of
ML. Now many industries are developing more robust models capable of analyzing
bigger and more complex data while delivering faster, more accurate results on vast
scales.
ML tools enable organizations to more quickly identify profitable opportunities
and potential risks.
Page | 15
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
While many are rightfully wary of self-driving cars right now, these cars will
become more common. The secret is machine learning. The algorithms collect data via
sensors and cameras, analyze the data, and decide what the car shoulddo. One team at
Boston University recently created a “watch and learn” algorithm that taught self-
driving cars to drive by watching other cars. In a test set in two virtual towns, the self-
driving neural networks got into very few accidents and reached their destinations
92% of the time.
Page | 16
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
Many jobs put human life at risk. Nuclear cleanup is a big one. In 2021, scientists
participated in a consortium focused on using AI and robotics in nuclear
environments. Using machine learning, robots can be trained to recognize the
differences between radioactive waste types. This would help humans safely identify
and get rid of nuclear waste. Machine learning could also make robots very effective
at jobs involving dangerous chemicals, extreme heavy lifting.
Many people struggle with transitioning into older age. Machine learning andAI
could help. Remote patient monitoring (RPM) is just one example. From wearable
devices, RPM collects information like heart rate, oxygen levels, blood pressure, and
more. It’s a great way for clinicians to monitor patients with chronic diseases without
them needing to come in for constant in-person visits.RPM can also help predict future
health issues.
Page | 17
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
Page | 18
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
The banking industry is complicated. Can machine learning streamline anything? It has
many uses, but fraud detection is a noteworthy one. Hackers are becoming more
advanced and banks are struggling. Thanks to their ability to process huge volumes of
data very quickly, machine learning algorithms designed for fraud detection can
identify malicious activity, verify user identity and respond immediately to attacks.
For banks, this reduces the risk of databreaches and cyberattacks.
When hackers use machine learning, each attack – successful or not – becomes a
learning experience. The AI gathers more and more information, making each attack
smarter and more effective. It’s a common problem with technological advancements:
there are always malicious actors. To combat these advanced threats and more outdated
(but still dangerous) attacks, organizations need defences that are just as effective.
Machine learning can analyze past attacks, respond to activity in real-time, automate
tasks, and help save money.
Page | 19
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
Page | 20
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
Some aspects thathave been already addressed by machine learning include addressing
financial queries with the help of chatbots, making predictions, managing expenses,
simplifying invoicing, and automating bank reconciliations.
Page | 21
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
Thanks to the huge hype surrounding the IoT, machine learning has experienced
a great rise in popularity. IoT is being designated as a strategicallysignificant area by
many companies. Many of these businesses have failed to address it. In this scenario,
machine learning is probably the best technology that can be used to attain higher
levels of efficiency. By merging machine learning with IoT, businesses can boost the
efficiency of their entire productionprocesses.
It’s a fact that fostering a positive credit score usually takes discipline, time, and
lots of financial planning for a lot of consumers. When it comes to the lenders, the
consumercredit score is one of the biggest measures of creditworthiness that involve a
number of
factors including payment history, total debt, length of credit history etc. Theycan
now predict whether the customer is a low spender or a high spender and understand
his/her tipping point of spending. Apart from mortgage lending, financial
institutions are using the same techniques for other types of consumerloans.
Page | 23
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
Based on the methods and way of learning, machine learning is divided intomainly
four types, which are:
Page | 24
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
3. Reinforcement Learning
1. SUPERVISED LEARNING:
Page | 25
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
The main goal of the supervised learning technique is to map the input
variable(x) with the output variable(y). Some real-world applications of supervised
learning are Risk Assessment, Fraud Detection, Spam filtering, etc.
Supervised machine learning can be classified into two types of problems, which
are given below:
i. CLASSIFICATION
ii. REGRESSION
Page | 26
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
a) CLASSIFICATION
Classification algorithms are used to solve the classification problems in which the
output variable is categorical, such as "Yes" or No, Male or Female, Red or Blue,
etc. The classification algorithms predict the categories present in the dataset. Some
real-world examples of classification algorithms are Spam Detection, Email filtering,
etc.
b) REGRESSION
✓ Lasso Regression
Page | 27
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
In unsupervised learning, the models are trained with the data that is neither
classified nor labelled, and the model acts on that data without any supervision.The
main aim of the unsupervised learning algorithm is to group or categories the
unsorted dataset according to the similarities, patterns,and differences. Machines are
instructed to find the hidden patterns from the input dataset.
Unsupervised Learning can be further classified into two types, which are givenbelow:
i. Clustering
ii. Association
Page | 28
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
a) Clustering
The clustering technique is used when we want to find the inherent groups from
the data. It is a way to group the objects into a cluster such that the objectswith the most
similarities remain in one group and have fewer or no similarities with the objects of
other groups. An example of the clustering algorithm is grouping the customers by
their purchasing behaviour.
✓ Mean-shift algorithm
✓ DBSCAN Algorithm
b) Association
Page | 29
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
Some popular algorithms of Association rule learning are Apriori Algorithm, Eclat,
FP-growth algorithm.
3. REINFORCEMENT LEARNING
Due to its way of working, reinforcement learning is employed in different fields such
as Game theory, Operation Research, Information theory, multi- agent systems.
Page | 30
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
1. Image Recognition
4. Medical Diagnosis
6. Speech Recognition
Page | 31
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
9. Product Recommendations
Page | 32
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
Problem Statement :
Problem arise when user have difficult to find their preferred type of movie according to
their previously watched movie that has been aligned with their interests and viewing habits.
Thus, it will spend a lot of time and energy consuming for manual search. With a vast number
of movies available, users often struggle to find movies that align with their preferences. They
may spend a significant amount of time searching for suitable movies, leading to frustration
and decision fatigue. Traditional movie recommendations, such as generic genre-based
suggestions, may not cater to individual preferences. Users desire personalized
recommendations that consider their specific tastes, leading to a more engaging and satisfying
movie-watching experience. So, Movie Recommender System can leverage algorithms and
techniques to analyze user data, including preferences, ratings, and viewing history. By
understanding user preferences and employing content-based filtering techniques, the system
can generate similar movie according to previously watched movie that has been aligned with
their interests and viewing habits. This recommendations, making it easier for users to find
movies they are likely to enjoy.
Objectives :
The objective is to create a movie recommender system that assists users in
discovering new movies aligned with their interests and viewing habits. The system should
employ advanced algorithms to analyze user data, including preferences, past ratings, and
viewing history, in order to generate accurate and tailored movie recommendations.
Page | 33
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
Recommendation System :
Recommender systems help to searching through large volume of dynamically
generated information to provide users with personalized content and services. This has
increased the demand for recommender systems more than ever before. It is an
information filtering systems that deal with the problem of information overload by
filtering vital information fragment out of large amount of dynamically generated
information according to user’s preferences, interest, or observed behaviour about item.
[1]. Recommender Systems have been widely used for product recommendations such as
books and movies as well as, it is also gaining ground in service recommendations such
as hotels, restaurants and travel attractions.
[2]. This project purpose a recommender system for help users to make a selection hotel
Page | 34
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
Page | 36
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
Content-Based approach
Recommendation is based on the items that have similar content and
characteristics to those the user liked before. A dataset that contains past user transactions is
split into training and testing set. It is all about theories of consumer buying behaviour.
Content based recommendations are independent of characteristics 8 of other users [1]. The
system does not recommend the type of item that are different from anything that user has
already choose. Thus, problem will occur when user want to try something new and system
would never make it happen.
Content-based filtering is created based on keeping in mind the profile of the client's
affinity and the initial database data. In this, to precisely predict the things we have castoff
the ratings recorded by the clients to the movies or TV Series and users favored likes and
dislikes to the shows. And by the end of the day at the background of the software using
Collaborative Filtering methodand estimations endorse those things or like those things that
were favored before previously. It calculates and predicts the new shows and or earlier based
predicted things and proposes best movies or shows based on his likes and dislikes items. It
Page | 37
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
uses different strategies and projection methods on different areas of use. This method is
mostly used in Hybrid Recommender Systems. An older calculations or the predictions of
motion pictures or movies through MOVIEGEN datasets have different implementations, for
ex, this demonstrates the movement of users request, with what had been searched in the past
is also saved in the history or in the database. On learning these mistakes, we have developed
Movie Recommendation System using Pearson Correlation Method, an advance method
based structure that predicts and outputs movies to customers reliant for a data given by the
customers in the past and the present examination, a customer is given the decision to pick
his choices from a great deal of qualities based on No. Of Ratings and Rating to each movie,
etc. We update the users choices in the database and computes a new set of results from the
new data provided and based on the choices of the past visited history of customers. The
software is developed using Python and a simple user interface.
Page | 38
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
Page | 39
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
Rule-Based
One of the most popular approaches to knowledge representation is to use
production rules into the system. Rule based also known as expert system that are
invented in the earlier 1970’s and are still in use until now. The definitions of rulebased
system depend almost entirely on expert systems, which are system that capture the
reasoning of human expert in solving a knowledge intensive problem. Instead of
representing knowledge in a declarative, static way as a set of things which are true, the
rule-based system represent knowledge in terms of a set of rules that tells what to do or
make a conclusion. A rule-based system can be simply created by using asset of assertions
and a set of rules that specify how to act on the assertion set. Rules are expressed as a set
of if-then statements, sometimes called IF-THEN rules. Rule reasoning is process to
derive a value for a conclusion. There are two means of deriving conclusions. First, start
with all the known data and progress toward the conclusion by using data driven, forward
chaining or forward reasoning. Second, select a possible conclusion and try to prove its
validity by looking for supporting evidence by using goal driven, backward chaining, or
backward reasoning. Figure 2.2 below shows an example for rule reasoning:
Rule 1
• IF Surface = smooth AND Fruitclass= vine AND Color = green
• THEN Fruit = honeydew
Each rule describes some characteristic of the different fruits through a series of parameters,
for example:
• Fruit
• Fruitclass
• Seedclass
Parameters that represent the final answer are conclusions or goals. Hotel
Recommend System will use rule to describe some characteristic of the different hotel
through a series of parameters. In a nutshell, hotel recommendation system will use rules
for knowledge representation which is rule-based to provide the problem-solving to this
project.
LIBRARIES REQUIRED :
➢ NUMPY:
NumPy (Numerical Python) is an open source Python library that’s used in
almost every field of science and engineering. The NumPy API is used
extensively in Pandas, SciPy, Matplotlib, scikit-learn, scikit-image and most
other data science and scientific Python packages. It is a Python library that
provides a multidimensional array object, various derived objects (such as
masked arrays and matrices), and an assortment of routines for fast operations on
arrays, including mathematical, logical, shape manipulation, sorting, selecting,
I/O, discrete Fourier transforms, basic linear algebra, basic statistical operations,
random simulation and much more.
The NumPy library contains multidimensional array and matrix data
structures (you’ll find more information about this in later sections). It
Page | 41
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
import numpy as np
We shorten the imported name to np for better readability of code using NumPy. This
is a widely adopted convention that you should follow so that anyone working with your code
can easily understand it.
>>>a= np.arrange(6)
>>>a2=va[np.newaxis, :]
>>>a2.shape
OUTPUT: (1,6)
Page | 42
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
➢ PANDAS
Pandas is an open-source library that is made mainly for working with relational
or labeled data both easily and intuitively. It provides various data structures and
operations for manipulating numerical data and time series. This library is built on
Page | 43
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
top of the NumPy library. Pandas is fast and it has high performance & productivity
for users.
Pandas generally provide two data structures for manipulating data,
They are:
1. Series
2. DataFrame
Example:
import pandas as pd
import numpy as np
print(ser)
# simple array
data = np.array(['g', 'e', 'e', 'k', 's'])
ser = pd.Series(data)
print(ser)
Output :
Page | 44
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
➢ NLTK
NLTK is a leading platform for building Python programs to work with human
language data. It provides easy-to-use interfaces to over 50 corpora and lexical resources such
as WordNet, along with a suite of text processing libraries for classification, tokenization,
stemming, tagging, parsing, and semantic reasoning, wrappers for industrial-strength NLP
libraries, and an active discussion forum. (NLP) is a field that focuses on making natural
human language usable by computer programs. NLTK, or Natural Language Toolkit, is a
Python package that you can use for NLP.
A lot of the data that you could be analyzing is unstructured data and contains human-readable
text. Before you can analyze that data programmatically, you first need to preprocess it. In this
tutorial, you’ll take your first look at the kinds of text preprocessing tasks you can do with
NLTK so that you’ll be ready to apply them in future projects. You’ll also see how to do some
basic text analysis and create visualizations.
Page | 45
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
Natural language processing (NLP) is a field that focuses on making natural human language
usable by computer programs. NLTK, or Natural Language Toolkit, is a Python package that
you can use for NLP.
A lot of the data that you could be analyzing is unstructured data and contains human-
readable text. Before you can analyze that data programmatically, you first need to
preprocess it. In this tutorial, you’ll take your first look at the kinds of text
preprocessing tasks you can do with NLTK so that you’ll be ready to apply them in future
projects. You’ll also see how to do some basic text analysis and create visualizations.
If you’re familiar with the basics of using Python and would like to get your feet wet with
some NLP, then you’ve come to the right place.
We will be using Python library NLTK (Natural Language Toolkit) for doing text analysis in
English Language. The Natural language toolkit (NLTK) is a collection of Python libraries
designed especially for identifying and tag parts of speech found in the text of natural language
like English.
Installing NLTK
Before starting to use NLTK, we need to install it. With the help of following command, we can
install it in our Python environment −
If we are using Anaconda, then a Conda package for NLTK can be built by using the following
command −
Page | 46
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
After installing NLTK, another important task is to download its preset text repositories so that
it can be easily used. However, before that we need to import NLTK the way we import any
other Python module. The following command will help us in importing NLTK −
import nltk
Now, download NLTK data with the help of the following command −
nltk.download()
Some other Python packages like gensim and pattern are also very necessary for text analysis
as well as building natural language processing applications by using NLTK. the packages can
be installed as shown below −
gensim
gensim is a robust semantic modeling library which can be used for many applications. We can
install it by following command −
It can be used to make gensim package work properly. The following command helps in
installing pattern −
Lemmatization
It is another way to extract the base form of words, normally aiming to remove inflectional
endings by using vocabulary and morphological analysis. After lemmatization, the base form of
any word is called lemma.
Page | 47
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
WordNetLemmatizer package
This package will extract the base form of the word depending upon whether it is used as a noun
or as a verb. The following command can be used to import this package −
The identification of parts of speech (POS) and short phrases can be done with the help of
chunking. It is one of the important processes in natural language processing. As we are aware
about the process of tokenization for the creation of tokens, chunking actually is to do the
labeling of those tokens. In other words, we can say that we can get the structure of the sentence
with the help of chunking process.
Example
In this step, we need to define the grammar for chunking. It would consist of the rules, which
we need to follow.
Next, we need to create a chunk parser. It would parse the grammar and give the output.
import nltk
Here,
Page | 48
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
• DT is the determinant
• VBP is the verb
• JJ is the adjective
• IN is the preposition
• NN is the noun
sentence = [("a", "DT"),("clever","JJ"),("fox","NN"),("was","VBP"),
("jumping","VBP"),("over","IN"),("the","DT"),("wall","NN")]
grammar = "NP:{<DT>?<JJ>*<NN>}"
parser_chunking = nltk.RegexpParser(grammar)
parser_chunking.parse(sentence)
Output = parser_chunking.parse(sentence)
Now, the following code will help you draw your output in the form of a tree.
output.draw()
Page | 49
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
Tokenizing
Tokenization may be defined as the Process of breaking the given text, into smaller units called
tokens. Words, numbers or punctuation marks can be tokens. It may also be called word
segmentation.
Example
We have different packages for tokenization provided by NLTK. We can use these packages
based on our requirements. The packages and the details of their installation are as follows −
sent_tokenize package
This package can be used to divide the input text into sentences. We can import it by using the
following command −
This package can be used to divide the input text into words. We can import it by using the
following command −
This package can be used to divide the input text into words and punctuation marks. We can
import it by using the following command −
Page | 50
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
When you’re analyzing text, you’ll be tokenizing by word and tokenizing by sentence. Here’s
what both types of tokenization bring to the table:
• Tokenizing by word: Words are like the atoms of natural language. They’re the smallest
unit of meaning that still makes sense on its own. Tokenizing your text by word allows
you to identify words that come up particularly often. For example, if you were analyzing
a group of job ads, then you might find that the word “Python” comes up often. That
could suggest high demand for Python knowledge, but you’d need to look deeper to know
more.
• Tokenizing by sentence: When you tokenize by sentence, you can analyze how those
words relate to one another and see more context. Are there a lot of negative words around
the word “Python” because the hiring manager doesn’t like Python? Are there more terms
from the domain of herpetology than the domain of software development, suggesting
that you may be dealing with an entirely different kind of python than you were
expecting?
Here’s how to import the relevant parts of NLTK so you can tokenize by word and by sentence:
>>>
>>>
>>>
Page | 51
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
>>> sent_tokenize(example_string)
["Muad'Dib learned rapidly because his first training was in how to learn.",
'And the first lesson of all was the basic trust that he could learn.',
"It's shocking to find how many people do not believe they can learn, and how many more
believe learning to be difficult."]
Tokenizing example_string by sentence gives you a list of three strings that are sentences:
1. "Muad'Dib learned rapidly because his first training was in how to learn."
2. 'And the first lesson of all was the basic trust that he could learn.'
3. "It's shocking to find how many people do not believe they can learn, and how many more
believe learning to be difficult."
>>>
>>> word_tokenize(example_string)
["Muad'Dib",
'learned',
'rapidly',
'because',
'his',
'first',
'training',
'was',
'in',
'how',
'to',
'learn',
'.',
'And',
'the',
'first',
Page | 52
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
'lesson',
'of',
'all',
'was',
'the',
'basic',
'trust',
'that',
'he',
'could',
'learn',
'.',
'It',
"'s",
'shocking',
'to',
'find',
'how',
'many',
'people',
'do',
'not',
'believe',
'they',
'can',
'learn',
',',
'and',
'how',
'many',
'more',
Page | 53
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
'believe',
'learning',
'to',
'be',
'difficult',
'.']
You got a list of strings that NLTK considers to be words, such as:
• "Muad'Dib"
• 'training'
• 'how'
• "'s"
• ','
• '.'
See how "It's" was split at the apostrophe to give you 'It' and "'s", but "Muad'Dib" was left
whole? This happened because NLTK knows that 'It' and "'s" (a contraction of “is”) are two
distinct words, so it counted them separately. But "Muad'Dib" isn’t an accepted contraction
like "It's", so it wasn’t read as two separate words and was left intact.
Here’s how to import the relevant parts of NLTK in order to filter out stop words:
>>>
>>> nltk.download("stopwords")
Page | 54
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
>>>
>>>
>>>
>>>
>>> filtered_list = []
You created an empty list, filtered_list, to hold all the words in words_in_quote that aren’t stop
words. Now you can use stop_words to filter words_in_quote:
>>>
Page | 55
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
Alternatively, you could use a list comprehension to make a list of all the words in your text that
aren’t stop words:
>>>
>>> filtered_list = [
... word for word in words_in_quote if word.casefold() not in stop_words
... ]
When you use a list comprehension, you don’t create an empty list and then add items to the end
of it. Instead, you define the list and its contents at the same time. Using a list comprehension is
often seen as more Pythonic.
>>>
>>> filtered_list
['Sir', ',', 'protest', '.', 'merry', 'man', '!']
You filtered out a few words like 'am' and 'a', but you also filtered out 'not', which does affect
the overall meaning of the sentence. (Worf won’t be happy about this.)
Words like 'I' and 'not' may seem too important to filter out, and depending on what kind of
analysis you want to do, they can be. Here’s why:
• 'I' is a pronoun, which are context words rather than content words:
o Content words give you information about the topics covered in the text or the
sentiment that the author has about those topics.
o Context words give you information about writing style. You can observe
patterns in how authors use context words in order to quantify their writing style.
Once you’ve quantified their writing style, you can analyze a text written by an
unknown author to see how closely it follows a particular writing style so you can
try to identify who the author is.
Page | 56
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
• 'not' is technically an adverb but has still been included in NLTK’s list of stop words for
English. If you want to edit the list of stop words to exclude 'not' or make other changes,
then you can download it.
So, 'I' and 'not' can be important parts of a sentence, but it depends on what you’re trying to learn
from that sentence.
Stemming
Stemming is a text processing task in which you reduce words to their root, which is the core
part of a word. For example, the words “helping” and “helper” share the root “help.” Stemming
allows you to zero in on the basic meaning of a word rather than all the details of how it’s being
used. NLTK has more than one stemmer, but you’ll be using the Porter stemmer. Due to
grammatical reasons, language includes lots of variations. Variations in the sense that the
language, English as well as other languages too, have different forms of a word. For example,
the words like democracy, democratic, and democratization. For machine learning projects, it
is very important for machines to understand that these different words, like above, have the
same base form. That is why it is very useful to extract the base forms of the words while
analyzing the text.
Stemming is a heuristic process that helps in extracting the base forms of the words by chopping
of their ends.
The different packages for stemming provided by NLTK module are as follows −
PorterStemmer package
Porter’s algorithm is used by this stemming package to extract the base form of the words. With
the help of the following command, we can import this package −
For example, ‘write’ would be the output of the word ‘writing’ given as the input to this
stemmer.
Page | 57
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
LancasterStemmer package
Lancaster’s algorithm is used by this stemming package to extract the base form of the words.
With the help of following command, we can import this package −
For example, ‘writ’ would be the output of the word ‘writing’ given as the input to this
stemmer.
SnowballStemmer package
Snowball’s algorithm is used by this stemming package to extract the base form of the words.
With the help of following command, we can import this package −
For example, ‘write’ would be the output of the word ‘writing’ given as the input to this
stemmer.
Here’s how to import the relevant parts of NLTK in order to start stemming:
>>>
>>>
>>>
Page | 58
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
Before you can stem the words in that string, you need to separate all the words in it:
>>>
>>>
>>> words
['The',
'crew',
'of',
'the',
'USS',
'Discovery',
'discovered',
'many',
'discoveries',
'.',
'Discovering',
'is',
'what',
'explorers',
'do',
'.']
Create a list of the stemmed versions of the words in words by using stemmer.stem() in a list
comprehension:
>>>
Page | 59
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
>>>
>>> stemmed_words
['the',
'crew',
'of',
'the',
'uss',
'discoveri',
'discov',
'mani',
'discoveri',
'.',
'discov',
'is',
'what',
'explor',
'do',
'.']
Here’s what happened to all the words that started with 'discov' or 'Discov':
'Discovery' 'discoveri'
'discovered' 'discov'
'discoveries' 'discoveri'
'Discovering' 'discov'
Page | 60
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
1. Understemming happens when two related words should be reduced to the same stem
but aren’t. This is a false negative.
2. Overstemming happens when two unrelated words are reduced to the same stem even
though they shouldn’t be. This is a false positive.
The Porter stemming algorithm dates from 1979, so it’s a little on the older side. The Snowball
stemmer, which is also called Porter2, is an improvement on the original and is also available
through NLTK, so you can use that one in your own projects. It’s also worth noting that the
purpose of the Porter stemmer is not to produce complete words but to find variant forms of a
word.
➢ PICKLE
Python pickle module is used for serializing and de-serializing python object structures. The
process to converts any kind of python objects (list, dict, etc.) into byte streams (0s and 1s) is
called pickling or serialization or flattening or marshalling. We can converts the byte stream
(generated through pickling) back into python objects by a process called as unpickling.
In real world sceanario, the use pickling and unpickling are widespread as they allow us to easily
transfer data from one server/system to another and then store it in a file or database.
Precaution: It is advisable not to unpickle data received from an untrusted source as they may
pose security threat. However, the pickle module has no way of knowing or raise alarm while
pickling malicious data.
Only after importing pickle module we can do pickling and unpickling. Importing pickle can be
done using the following command −
import pickle
Pickle examples:
import pickle
Page | 61
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
pickle.dump(mylist, fh)
In the above code, list – “mylist” contains four elements (‘a’, ‘b’, ‘c’, ‘d’). We open the file in
“wb” mode instead of “w” as all the operations are done using bytes in the current working
directory. A new file named “datafile.txt” is created, which converts the mylist data in the byte
stream.
import pickle
emp = pickle.load(pickle_off)
print(emp)
Output: On running above scripts, you can see your mylist data again as output.
import pickle
EmpID = {1:"Zack",2:"53050",3:"IT",4:"38",5:"Flipkart"}
pickling_on = open("EmpID.pickle","wb")
pickle.dump(EmpID, pickling_on)
pickling_on.close()
Unpickle a dictionary −
import pickle
EmpID = pickle.load(pickle_off)
print(EmpID)
Page | 62
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
On running above script(unpickle) we get our dictionary back as we initialized earlier. Also,
please note because we are reading bytes here, we have used “rb” instead of “r”.
Output
❖ Object sharing (references to the same object in different places): This is similar to self-
referencing objects; pickle stores the object once, and ensures that all other references
point to the master copy. Shared objects remain shared, which can be very important for
mutable objects.
❖ User-defined classes and their instances: Marshal does not support these at all, but pickle
can save and restore class instances transparently. The class definition must be
importable and live in the same module as when the object was stored.
➢ STREAMLIT
Streamlit is a free and open-source framework to rapidly build and share beautiful
machine learning and data science web apps. It is a Python-based library specifically
designed for machine learning engineers. Data scientists or machine learning engineers
are not web developers and they're not interested in spending weeks learning to use these
frameworks to build web apps. Instead, they want a tool that is easier to learn and to use,
as long as it can display data and collect needed parameters for modeling. Streamlit
allows you to create a stunning-looking application with only a few lines of code.
With Streamlit, you can create a web application directly from your
Python script without the need for HTML, CSS, or JavaScript knowledge. It provides a
Page | 63
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
range of built-in components and widgets that you can use to create interactive elements
such as sliders, dropdowns, charts, and tables. You can also leverage popular Python
libraries like Matplotlib, Pandas, and Plotly to visualize data within your app.
❖ Create a new Python script and import the necessary libraries, such as Streamlit and the
ones you need for data processing and visualization.
❖ Write the code for your app, including data loading, processing, and any visualizations
or interactive elements you want to include.
❖ Use Streamlit's API to define the layout and behavior of your app. You can use functions
like st.sidebar for sidebar elements, st.write to display text or data, and st.pyplot to show
plots generated with other libraries.
❖ Run the Streamlit development server by executing streamlit run your_script.py in your
terminal. This will start the server and launch your app in a web browser.
❖ Streamlit provides automatic live reloading, which means that any changes you make to
your Python script will be immediately reflected in the running app, allowing you to
iterate quickly.
❖ Streamlit also offers additional features like caching, sharing apps, and deploying them
to various platforms. You can explore the Streamlit documentation and community
resources for more information and examples to get started with building your own
interactive web applications.
Let’s install streamlit. Type the following command in the command prompt.
Page | 64
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
Once Streamlit is installed successfully, run the given python code and if you do not get an
error, then streamlit is successfully installed and you can now work with streamlit.
Here my
1. Title:
• Python3
# import module
import streamlit as st
# Title
Output:
Page | 65
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
Figure 27 : title
• Python
# Header
st.header("This is a header")
# Subheader
st.subheader("This is a subheader")
Output:
3. Text:
• Python3
# Text
st.text("Hello GeeksForGeeks!!!")
Output:
Page | 66
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
Figure 29 : Text
4. Markdown:
• Python3
# Markdown
Output:
Figure 30 : Markdown
• Python3
# success
st.success("Success")
# success
st.info("Information")
Page | 67
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
# success
st.warning("Warning")
# success
st.error("Error")
st.exception(exp)
Output:
Page | 68
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
6. Write:
Using write function, we can also display code in coding format. This is not possible using
st.text(”).
• Python3
# Write text
st.write(range(10))
Output:
7. Display Images:
• Python3
# Display Images
img = Image.open("streamlit.png")
Page | 69
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
st.image(img, width=200)
Output:
8. Checkbox:
A checkbox returns a boolean value. When the box is checked, it returns a True value else
returns a False value.
• Python3
# checkbox
if st.checkbox("Show/Hide"):
Page | 70
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
Output:
9. Radio Button:
• Python3
# radio button
if (status == 'Male'):
st.success("Male")
else:
Page | 71
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
st.success("Female")
Output:
• Python3
# Selection box
Page | 72
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
Output:
11. Multi-Selectbox:
The multi-select box returns the output in the form of a list. You can select multiple options.
• Python3
Page | 73
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
Output:
12. Button:
st.button() returns a boolean value. It returns a True value when clicked else returns False.
• Python3
Page | 74
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
if(st.button("About")):
st.text("Welcome To GeeksForGeeks!!!")
Output:
• Python3
# Text Input
# second argument displays a default text inside the text input area
Page | 75
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
if(st.button('Submit')):
result = name.title()
st.success(result)
Output:
Text Input
Figure 44: Display success message when the Submit button is clicked
Page | 76
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
14. Slider:
• Python3
# slider
st.text('Selected: {}'.format(level))
Output:
Mini Project:
Let us recollect everything that we learn above and create a BMI Calculator web app.
The formula of BMI Index when weight is in Kgs and height is in meters is:
Page | 77
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
• Python3
import streamlit as st
if(status == 'cms'):
height = st.number_input('Centimeters')
try:
Page | 78
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
except:
elif(status == 'meters'):
height = st.number_input('Meters')
try:
except:
else:
height = st.number_input('Feet')
# 1 meter = 3.28
try:
except:
Page | 79
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
if(st.button('Calculate BMI')):
st.success("Healthy")
st.warning("Overweight")
st.error("Extremely Overweight")
Page | 80
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
Output:
Height in Meters:
Page | 81
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
Height in Feet:
ARCHITECTURE DIAGRAM
WORKING
Before going to code part, we will download dataset, and then we will use it in code.
DATASET
Here in this project we are going to use the dataset from Kaggle. We will use these
following dataset:
1. tmdb_5000_credits
2. tmdb_5000_movies
Page | 83
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
Page | 84
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
Page | 85
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
Page | 86
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
Page | 87
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
Page | 88
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
Page | 89
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
Page | 90
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
Page | 91
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
Page | 92
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
Page | 93
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
VECTORIZATION
Page | 94
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
Page | 95
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
Page | 96
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
IMPORTING PICKLE
For getting IMDB Rating in frontend we have to import IMDB. To access IMDb
(Internet Movie Database) data using Python, you can make use of the IMDbPY library.
IMDbPY is a Python package that provides an interface to the IMDb database, allowing you
to retrieve information about movies, TV shows, actors, and more.
To get started, you'll need to install the IMDbPY library. You can do this by running
the following command in your Python environment:
Once we have installed this library, now we can use it in movie recommender system.
import streamlit as st
import pickle
import pandas as pd
import requests
import imdb
Page | 97
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
return None
if 'poster_path' in data:
return "https://image.tmdb.org/t/p/w500/" +
data['poster_path']
else:
return None
# Streamlit app code
st.title('MOVIE RECOMMENDER SYSTEM ')
name = st.text_input("Enter your name")
if st.button("Next"):
st.session_state["name"] = name
st.experimental_rerun()
if "name" in st.session_state:
Page | 98
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
st.subheader("Hello, " + st.session_state["name"])
def recommend(movie):
movie_index = movies[movies['title'] == movie].index[0]
distances = similarity[movie_index]
movies_list = sorted(list(enumerate(distances)),
reverse=True, key=lambda x: x[1])[1:6]
recommended_movies = []
recommended_movies_posters = []
recommended_movies_ratings = []
for i in movies_list:
movie_id = movies.iloc[i[0]].movie_id
movie_title = movies.iloc[i[0]].title
recommended_movies.append(movie_title)
# Fetch poster from TMDb
recommended_movies_posters.append(fetch_poster(movie_id))
# Fetch IMDb rating
recommended_movies_ratings.append(fetch_imdb_rating(movie_title))
Page | 99
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
if st.button('Recommend Movie'):
names, posters, ratings = recommend(selected_movie_name)
st.subheader('Below are some similar movies:')
Page | 100
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
RUN STREAMLIT
then a Local and Network URL will be generated and it will be open in your browser
WEBPAGE
Page | 101
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
Page | 102
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
APPLICATIONS:
Page | 103
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
❖ E-commerce Websites: Online marketplaces that sell movies, such as Amazon, often
employ recommender systems to suggest relevant movies to their customers based on their
browsing history, purchase behavior, and ratings.
❖ Social Media Platforms: Social media platforms like Facebook and Twitter have
integrated movie recommender systems to enhance user engagement. By analyzing user
profiles, interests, and interactions, these systems recommend movies that align with users'
preferences and enable them to share and discuss their favorite films with friends.
❖ Movie Review Websites: Platforms like IMDb and Rotten Tomatoes use movie
recommender systems to suggest films to their users based on their ratings, reviews, and
browsing behavior. This helps users discover movies that are likely to appeal to their tastes
and preferences.
❖ Personalized Advertising: Movie recommender systems can also be used for targeted
advertising. By analyzing user preferences and viewing habits, advertisers can deliver
personalized movie recommendations as part of their marketing campaigns. This allows
them to promote relevant movies and increase the likelihood of user engagement and
conversions and many more.
ADVANTAGES:
❖ Increased User Engagement: Recommender systems play a crucial role in keeping users
Page | 104
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
❖ Discovery of New Movies: Movie recommender systems expose users to a wider range
of movies and genres that they may not have otherwise discovered. By analyzing user
preferences and behaviors, these systems recommend movies that have a higher chance
of being well-received by the user.
❖ Increased Revenue and Sales: Recommender systems can have a positive impact on
revenue and sales for businesses. By suggesting movies that align with users' preferences,
these systems can increase the likelihood of users renting or purchasing movies.
❖ Improved User Satisfaction: When users receive relevant movie recommendations that
cater to their preferences, they experience a higher level of satisfaction with the platform
or service. By delivering a personalized and curated experience, recommender systems
show that the platform understands and values the users' tastes and interests.
❖ Efficient Content Curation: Movie recommender systems automate the process of content
curation by analyzing vast amounts of user data and applying algorithms to generate
personalized recommendations. This reduces the manual effort required for users to
search and browse through a vast catalog of movies.
Page | 105
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
➢ System will recommend those movies which are in the dataset that is downloaded from
Kaggle, others will be shown error.
➢ It may provide inaccurate results if data entered incorrectly.
➢ For all recent movies, it will not recommend movies to the users as these movies are not
in the dataset provided here.
CONCLUSION:
Movie recommender systems have transformed the way we discover and engage
with movies. They offer personalized recommendations tailored to individual
preferences, leading to increased user satisfaction, engagement, and retention. By
suggesting movies that align with users' tastes, these systems save time and effort in the
search for content and help users explore new genres and hidden gems. Incorporating user
feedback and ratings, considering contextual factors, adopting hybrid approaches, and
providing explanations for recommendations can enhance the accuracy and relevance of
movie suggestions. Additionally, allowing user control and customization empowers
users to have a more active role in their movie selection process. As technology advances,
it is important for movie recommender systems to continue evolving to meet the ever-
changing needs and preferences of users. By addressing the challenges and incorporating
user-centric approaches, these systems can continue to provide valuable
recommendations and contribute to a more enriching and enjoyable movie-watching
experience for users worldwide. Moving forward, it is essential for movie recommender
systems to focus on providing diverse and contextually relevant recommendations, while
also respecting user privacy and offering transparency in their recommendation
processes. Striking a balance between personalization and serendipity, along with
considering user preferences and evolving tastes, will contribute to the continued
improvement and effectiveness of movie recommender systems.
Page | 106
MOVIE RECOMMENDER SYSTEM USING MACHINE LEARNING LIBRARIES
REFRENCES:
[1] Li H, Cai F, and Liao Z. Content-Based Filtering Recommendation Algorithm using HMM.
IEEE Transactions on Computational and Information Sciences, 8(1):275-277, 2012.
[2] Hirdesh Shivhare, Anshul Gupta and Shalki Sharma (2015), “Recommender system using
fuzzy c-means clustering and genetic algorithm based weighted similarity measure”, IEEE
International Conference on Computer, Communication and Control.
[3] Manoj Kumar, D.K. Yadav, Ankur Singh and Vijay Kr. Gupta (2015), “A Movie
Recommender System: MOVREC”, International Journal of Computer Applications (0975
– 8887) Volume 124 – No.3.
[4] Nitasha Soni; Krishan Kumar; Ashish Sharma; Satyam Kukreja; Aman Yadav Machine
Learning Based Movie Recommendation System | IEEE Conference Publication | IEEE
Xplore
[5] Shourya Chawla; Sumita Gupta; Rana Majumdar Movie Recommendation Models Using
Machine Learning | IEEE Conference Publication | IEEE Xplore
Page | 107