AI Project Shishi

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

PROJECT WORK

On
RECOMMENDER SYSTEM FOR MOVIES
Submitted to CMREC (UGC Autonomous)
In Partial Fulfillment of the requirements for the Award of Degree of
BACHELOR OF TECHNOLOGY
IN

INFORMATION TECHNOLOGY
Submitted By
KATIKA REDDY SHISHIRA 228R1A1222
Under the guidance of
MRS. G. SWETHA
Assistant Professor, Department of IT

DEPARTMENT OF INFORMATION TECHNOLOGY


CMR ENGINEERING COLLEGE
UGC AUTONOMOUS
(Approved by AICTE-New Delhi & J.N.T.U, Hyderabad) Kandlakoya(v),Medchal
Road,Hyderabad-501 401,Telangana State, India.
TABLE OF CONTENT

S.NO CONTENT PAGE.NO

1 DECLARATION 3

2 CERTIFICATE 4

3 ACKNOWLEDGEMENT 5

4 ABSTRACT 6

5 INTRODUCTION 7

6 SAMPLE DATA 8

7 IMPLEMENTATION 9-10

8 OUTPUT 11

9 CONCLUSION 12

2
DECLARATION

This is to certify that the work reported in the project entitled “Recommender System for
Movies” in a record of bonafide work done by OUR TEAM in the Department of Information
Technology, CMR Engineering College.
It is based on our study and/or research and that we have acknowledged all material and sources
used in its preparation, whether they be books, articles, reports, lecture notes, and any other
kind of document, electronic or personal communication.
We also certify that this project has not previously been submitted for assessment in any
academic capacity, and that I have not copied in part or whole or otherwise plagiarized the work
of other persons.
The reports are based on the Project work done entirely by me and not copied from any other
source. I submit my Project for further development by any interested students who share
similar interests to improve the Lead Experiment in the future.
The results embodied in this project have not been submitted to any other University or Institute
for the award of any degree or diploma to the best of our knowledge and belief. We confirm
that we have identified and declared all possible conflicts that we may have.

KATIKA REDDY SHISHIRA 228R1A1222

3
CERTIFICATE

CMR ENGINEERING COLLEGE


(Accredited by NBA. Approved by AICTE NEW DELHI, Affiliated to JNTU,Hyderabad)
Kandlaoya, Medchal Road, Hyderabad-501 401

Department of Information Technology

This is to certify that the Project entitled “Recommender System for Movies” is a bonafide work
carried out and submitted by Katika Reddy Shishira 228R1A1222 in partial fulfillment of the
requirement for the award of the degree of BACHELOR OF INFORMATION
TECHNOLOGY(IT) from CMR Engineering College.

The results presented in this Project have been verified and are found to be satisfactory & it is
successfully completed.

Internal Guide Head of the Department


MRS. G. SWETHA Dr. MADHAVI PINGILI
Assistant Professor, Assoc Professor & HOD,
Department of IT Department of IT
CMREC, Hyderabad CMREC, Hyderabad

4
ACKNOWLEDGEMENT

First of all, we would like to thank the almighty God for listening my prayers and giving me
strength to complete the dissertation work.
We would like to express a deep sense of gratitude and thanks profusely to MRS. G. SWETHA,
Assistant Professor, Department of IT, CMR Engineering College, our guide and mentor,
without the wise counsel and able guidance, it would have been impossible to complete the
dissertation in this manner.
We would like to express my sincere gratitude to our principal DR. A. SRINIVASULA REDDY
and our HOD DR. MADHAVI PINGILI and the College for providing me with facilities
required to do my project and we are also grateful to for cooperation to me for carrying out this
work. We shall be failing in our duty if we don't acknowledge the support received in order to
complete the work.
We must also express my deep regards and thanks to our parents for supporting and boosting
my morale so that we can overcome my hard times. we also want to thank our senior & our
friends.
We finally pray that almighty fulfils the aspirations of all the people who have been a part of
this journey and those who will be a part of future journeys.

5
ABSTRACT

This project involves building a movie recommender system that uses two core techniques:
content-based filtering and collaborative filtering. Recommender systems play a significant role
in delivering personalized suggestions across various platforms, enhancing user engagement by
tailoring content to individual preferences. Content-based filtering makes recommendations by
analyzing movie attributes, such as genres and other features, to identify similar items.
Collaborative filtering, on the other hand, utilizes user rating patterns to suggest movies based
on the preferences of users with similar tastes, forming recommendations from the user-item
matrix. The system is implemented in Python with the help of libraries like Pandas and Scikit-
Learn, which facilitate data processing and similarity computations. By combining these two
approaches, the recommender system provides a balanced mix of content-driven and user-
driven suggestions. This project demonstrates the application of machine learning techniques in
personalized recommendations and provides a framework for further refinement, such as
incorporating hybrid models and real-time updates to improve recommendation accuracy and
responsiveness.

Keywords: Recommender System, Collaborative Filtering, Content-Based Filtering, Movie


Recommendations.

6
INTRODUCTION

Recommender systems have become an essential part of modern-day applications, helping users
discover products, services, and content based on their preferences and past behaviour’s. In the
entertainment industry, particularly in movie streaming platforms, recommender systems play a
crucial role in enhancing user experience by providing personalized content suggestions. This
project focuses on building a movie recommender system using two primary techniques: content-
based filtering and collaborative filtering. Content-based filtering recommends items that are
similar to those a user has shown interest in, based on attributes such as genre, director, or
actors. On the other hand, collaborative filtering predicts a user's preferences by analysing the
ratings and behaviours of similar users, regardless of item attributes. By implementing these
techniques, we aim to provide movie recommendations that align with user interests while
considering both the content's features and user interaction data. The system uses Python, along
with libraries such as Scikit-Learn and Pandas, to process and analyze movie and user rating
data. The goal is to create a versatile recommendation engine that can suggest relevant movies,
improving user engagement and satisfaction. This project not only demonstrates the application
of machine learning techniques in the entertainment industry but also highlights the importance
of personalized recommendations in enhancing the overall user experience.

7
SAMPLE DATA
1. movies.csv

2. ratings.csv

8
IMPLEMENTATION

import pandas as pd
from sklearn.metrics.pairwise import cosine_similarity
from sklearn.feature_extraction.text import CountVectorizer

# Load movies and ratings data


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

# Content-based filtering: Create a genre matrix


count_vectorizer = CountVectorizer(tokenizer=lambda x: x.split('|'))
genre_matrix = count_vectorizer.fit_transform(movies['genres'])
genre_similarity = cosine_similarity(genre_matrix, genre_matrix)

# Collaborative filtering: Create a user-item rating matrix


user_ratings = ratings.pivot(index='userId', columns='movieId', values='rating').fillna(0)

# Content-Based Recommendation Function


def content_based_recommend(movie_title, top_n=5):
movie_idx = movies[movies['title'] == movie_title].index[0]
similarity_scores = list(enumerate(genre_similarity[movie_idx]))
sorted_scores = sorted(similarity_scores, key=lambda x: x[1], reverse=True)
recommended_movies = [movies.iloc[i[0]]['title'] for i in sorted_scores[1:top_n+1]]

print(f"Content-based recommendations for '{movie_title}':")


for movie in recommended_movies:
print(movie)
print()

# Collaborative-Based Recommendation Function


def collaborative_recommend(user_id, top_n=5):
user_similarity = cosine_similarity(user_ratings)
9
similar_users = list(enumerate(user_similarity[user_id-1]))
sorted_users = sorted(similar_users, key=lambda x: x[1], reverse=True)[1:]

recommendations = []
for user in sorted_users:
similar_user_id = user[0] + 1
similar_user_ratings = ratings[ratings['userId'] == similar_user_id]
user_watched_movies = ratings[ratings['userId'] == user_id]['movieId'].tolist()
for movie_id in similar_user_ratings['movieId']:
if movie_id not in user_watched_movies:
recommendations.append(movie_id)
if len(recommendations) >= top_n:
break
if len(recommendations) >= top_n:
break
recommended_titles = movies[movies['movieId'].isin(recommendations)]['title'].tolist()

print(f"Collaborative-based recommendations for user {user_id}:")


for title in recommended_titles:
print(title)
print()

# Testing the recommendations

# Content-based example
content_based_recommend('Toy Story (1995)')

# Collaborative-based example
collaborative_recommend(1)

10
OUTPUT

11
CONCLUSION

In this project, we developed a movie recommender system using two fundamental


recommendation techniques: content-based filtering and collaborative filtering. The content-
based approach relied on movie genre similarity to suggest movies that are similar to a user's
past preferences, while the collaborative filtering method leveraged user-item interactions to
recommend movies based on the ratings of similar users. By combining these techniques, the
system is capable of providing personalized recommendations that cater to individual tastes. The
use of cosine similarity helped measure the similarity between movies and users, allowing for
efficient and accurate suggestions. This recommender system demonstrates the power of
machine learning and data analysis in providing users with tailored content, making it a valuable
tool for enhancing user experience in media platforms. Further improvements can include
integrating hybrid models, handling cold-start problems, and incorporating more complex
algorithms to enhance the system's effectiveness.

12

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy