The Movie Recommendation
The Movie Recommendation
Django
Table of content
        Abstract
   1. Chapter 1: Introduction
           ○   1.1 Background
           ○   1.2 Problem Statement
           ○   1.3 Objectives
           ○   1.4 Scope of the Project
   2. Chapter 2: Literature Survey
           ○   2.1 Challenges in Movie Recommendation
           ○   2.2 AI and NLP in Recommendation Engines
           ○   2.3 Existing Systems and Limitations
           ○   2.4 Related Work
   3. Chapter 3: System Analysis
           ○   3.1 Existing System
           ○   3.2 Proposed System
           ○   3.3 Feasibility Study
           ○   3.4 Requirements Analysis
                   ■     3.4.1 Functional Requirements
                   ■     3.4.2 Non-Functional Requirements
   4. Chapter 4: System Design
           ○   4.1 System Architecture
           ○   4.2 Use Case Diagram
           ○   4.3 Data Flow Diagram
               4.4 UI Design
   5. Chapter 5: Implementation
           ○   5.1 Technology Stack
           ○   5.2 Use   Authentication
           ○   5.3 Chatbot and Genre Classifier
           ○   5.4 Voice Integration
           ○   5.5 Result Display and Navigation
   6. Chapter 6: Results and Discussion
           ○   6.1 Output Screenshots
           ○   6.2 Chatbot Interaction Flow
           ○   6.3 Recommendation Accuracy
           ○   6.4 User Feedback
    7. Chapter 7: Conclusion and Future Work
              ○   7.1 Conclusion
              ○   7.3 Limitations
              ○   7.2 Future Enhancements
    8. References
Chapter 1: Introduction
1.1 Background
Movies are a powerful medium of entertainment and education, consumed by billions globally. With the
explosion of content on platforms like Netflix, Amazon Prime, and YouTube, users are often overwhelmed
by choice. Hence, personalized movie recommendation systems have become increasingly valuable in
guiding users to discover relevant content efficiently.
The convergence of Artificial Intelligence, Natural Language Processing (NLP), and web development has
enabled the creation of intelligent recommendation systems that can suggest movies based on user
preferences, search history, or genre interests. This project presents a web-based AI-powered Movie
Recommendation System, developed using Django, that allows users to input movie titles, receive auto-
suggestions, interact with a genre-specific chatbot, and even use voice-based input for convenience.
With a massive and ever-growing movie database, users often face decision fatigue when choosing what to
watch. Most existing platforms provide limited recommendation logic or require sign-in history.
Additionally, non-technical users may prefer voice-based and intuitive chatbot interfaces to search for
movies.
Problem Statement: “To design and implement an AI-based movie recommendation system that provides
personalized suggestions based on user input, genre preferences, and natural voice or text interaction
through a Django-based web platform.”
1.3 Objectives
In Scope:
Out of Scope:
Libraries like Scikit-Learn, OpenAI models, or NLP frameworks such as spaCy, Rasa, and Hugging Face
Transformers help power these systems.
Popular platforms like Netflix, IMDB, and Letterboxd offer recommendations, but:
This project fills these gaps by building a Django-powered assistant combining traditional search, voice
input, and chatbot responses tailored to movie genres.
This chapter outlines the major components of the system, describing how each module contributes to the
overall functionality. The system architecture is modular, allowing for future expansion and easy
maintenance. The four primary components are: Frontend, Backend, Database, and Machine Learning
Service.
Frontend
The user interface is built using Django templates and styled with Tailwind CSS, a utility-first CSS
framework that allows for rapid design and consistent aesthetics across pages. The frontend is designed to
be clean, responsive, and accessible, ensuring usability on both desktop and mobile devices.
0The frontend interacts with the backend using standard form submissions and can be extended to include
AJAX or API-based data submission in future versions. Mobile responsiveness is achieved using
Tailwind's responsive breakpoints, ensuring optimal user experience on smaller screens.
Backend
The backend is developed in Django 4.x, a high-level Python web framework known for its scalability,
security, and built-in ORM. It handles:
    ●   Routing and Views: URL mappings are created for all major functionalities such as data entry,
        prediction, and dashboard access. Views control the logic for rendering templates or processing
        prediction requests.
    ●   Authentication and Authorization: Built-in Django auth is used for login, logout, and password
        protection. Users are grouped into roles using Django's Group model, enabling role-based access
        control.
    ●   Model Integration: The machine learning model is integrated into Django as a Python module. It
        is invoked during form processing to generate real-time predictions.
    ●   Data Validation and Security: The backend ensures input validation, uses CSRF protection on
        forms, and handles exceptions gracefully to prevent system crashes.
The architecture follows the Model-View-Template (MVT) design pattern, which cleanly separates data,
logic, and presentation layers.
Database
The system uses PostgreSQL as its primary relational database management system. PostgreSQL was
selected due to its robustness, ACID compliance, and support for advanced features such as JSON storage,
indexing, and role management.
    ●   User Accounts: Stores information about registered users, their roles, and credentials.
    ●   Prediction Logs: Captures environmental input values, recommended s, timestamps, and user ID
        for traceability.
    ●   Training Dataset Management (Admin Only): A provision to upload and manage datasets for
        retraining the ML model in the future.
    ●   Feedback Records: Planned for future implementation where          can submit feedback on the
        recommendation quality.
The Django ORM abstracts SQL queries and handles migrations seamlessly, which simplifies database
operations and schema evolution.
The core intelligence of the system lies in the Machine Learning service, implemented as a standalone
Python module integrated into the Django backend. The service uses a Random Forest Classifier trained
on a structured dataset containing labels and environmental features.
    ●   Model Training Script: Written in Python using pandas, scikit-learn, and NumPy. The
        model is trained offline and validated using test data before deployment.
    ●   Model Serialization: The trained model is serialized using joblib for efficient storage and fast
        loading at runtime.
    ●   Runtime Inference: When a user submits environmental data, the Django view loads the
        serialized model and passes the input to generate predictions in real-time.
    ●   Result Output: The prediction result is returned to the user interface along with optional metadata
        like confidence score (planned in future).
The design ensures that the model can be updated independently of the web app. Admins can retrain the
model offline and replace the serialized .pkl file without needing to redeploy the entire system.
Integration Workflow
    1. User Interaction: The user fills out the data to be used for prediction form via the frontend
        interface.
    2. Form Submission: The input is sent to a Django view through a secure POST request.
    3. Model Prediction: The backend view invokes the ML service, loads the model, and performs
        inference.
    4. Result Storage and Display: The prediction is stored in the database and returned to the frontend
        for display.
    5. Admin Access (Optional): Admins can view all prediction logs and performance analytics.
This modular and loosely coupled architecture ensures that each part of the system is independently
testable, replaceable, and scalable.
3.2 Proposed System
Technical Feasibility: The system is built using widely available open-source tools (Python,
Django, Scikit-learn). No proprietary software or specialized hardware is required. The ML
model is trained offline and loaded into memory during runtime using joblib.
Operational Feasibility: The system is easy to use and deploy. Once trained, the model can
serve multiple prediction requests in real time without needing re-training unless explicitly
required.
Economic Feasibility: Since the system uses open-source tools and publicly available
datasets, there are no direct costs involved. It is feasible for individual developers and
academic institutions.
1. Start
The process begins with the user requesting movie
recommendations.
2. Movie Data
This block represents the dataset containing details about
available movies (e.g., movie IDs, titles, genres). It feeds into both
the similarity calculation and final display process.
3. Transaction Data
This includes user interactions like movie ratings or viewing
history. It reflects what each user has watched and rated.
4. Finding User Similarity with Pearson Correlation
This module compares users based on their ratings of common
movies.
    Pearson correlation measures the strength of the linear
4.4 UI Design
    Place screen shot and write minimal explanation about the screenshot you can UI you
feel good
Chapter 5: Implementation
  1. Programming Languages
   Python
      Used for data processing, model training (machine learning), and back-end
      development (Django framework).
     HTML/CSS
      Used for designing the web front-end interface (forms, templates).
  2. Machine Learning and Data Science
   Pandas – For data loading and manipulation.
   3. Web Framework
    Django (Python-based Web Framework)
   4. Database
    SQLite
   5. Front-End
    Django Templates (HTML with template tags)
       Used to render web forms, display results, and interact with users dynamically.
   7. Development Tools
    Jupyter Notebook / Python scripts (for model development)
App 1: home/
This handles static or general site pages.
    admin.py, apps.py, models.py, views.py, urls.py: Standard Django files
      for model-view-template logic.
    templates/home/*.html: Pages like index.html, about.html, contact.html.
    migrations/: Tracks model changes in Django ORM.
App 2: movie/
This handles movie-related features, including recommendation and user
interaction.
     models.py: Defines Movie-related database models.
     forms.py: Contains Django forms for login, signup, and movie input.
     views.py: Contains logic for movie recommendations and result
       rendering.
     urls.py: Routes requests to appropriate views.
      templates/movie/: Contains HTML templates like login.html,
       signup.html, result.html, etc.
Explanation
   TF-IDF Vectorizer: Converts movie descriptions into numerical vectors
     while ignoring common English stopwords.
       Cosine Similarity: Measures how similar two movie descriptions are
        based on the angle between their vector representations.
       Model Saving: joblib.dump stores the trained TF-IDF and similarity
        matrix in a file (movie_model.pkl) to be loaded later during predictions in
        the web app.
   import pandas as pd
   from sklearn.feature_extraction.text import TfidfVectorizer
   from sklearn.metrics.pairwise import cosine_similarity
   import joblib
Functionality
    TF-IDF Vectorization: Converts text-based movie descriptions into
       numerical vectors based on term frequency and inverse document
       frequency.
    Cosine Similarity: Measures how similar two movies are based on their
       description vectors.
    Model Saving: Stores the dataset, vectorizer, and similarity matrix into
       a .pkl file (movie_model.pkl) for use in the web application.
Output (Saved Model)
After running this script:
    A movie_model.pkl file is generated.
    This file contains preprocessed data and a similarity matrix, which is used
       by the Django app to recommend similar movies based on input.
<script>
 function startRecognition() {
     const recognition = new webkitSpeechRecognition();
     recognition.lang = "en-US";
     recognition.onresult = function(event) {
         document.getElementById("queryInput").value = event.results[0]
[0].transcript;
     };
     recognition.start();
 }
</script>
5. Advantages
         Improves user experience and accessibility
         Provides faster input, especially for mobile users
         Enables hands-free interaction
6. Limitations
         Requires a modern browser with speech recognition support
     Accuracy depends on noise levels and microphone quality
     Not always effective for users with strong accents or speech impairments
Function: movie_result_view()
This function handles the recommendation process after a user
submits a movie title through the form.
Core logic:
model_data = joblib.load("movie_model.pkl")
recommendations = []
else:
sim_scores = list(enumerate(cosine_sim[idx]))
reverse=True)
sim_scores = sim_scores[1:6]
recommendations = data['movie_title'].iloc[rec_indices]
{% extends 'base.html' %}
{% block content %}
<div class="container mt-5">
  <h2 class="mb-4">Recommended Movies for
"{{ movie_input.movie_title }}"</h2>
  {% if recommendations %}
    <ul class="list-group">
          {% for movie in recommendations %}
            <li class="list-group-item">{{ forloop.counter }}. {{ movie
}}</li>
          {% endfor %}
    </ul>
  {% else %}
    <div class="alert alert-warning mt-3" role="alert">
         Sorry, we couldn't find recommendations for that movie title.
       </div>
  {% endif %}
Traditional accuracy metrics (like accuracy %, precision, recall) are not always meaningful
for content-based or collaborative filtering models, because:
       The system recommends items, not classifications.
       There's often no single correct answer—recommendations are subjective.
Example Output:
That means Movie 10 and Movie 20 are 85% similar based on their description—so the
recommendation is reasonably strong.
6.4 User Feedback
Types of User Feedback
   1. Explicit Feedback
          o   The user directly rates a movie (e.g., 1 to 5 stars).
          o   The user gives a thumbs-up/down to a recommendation.
          o   Example:
Like / Dislike buttons next to each recommended movie.
   2. Implicit Feedback
          o   Based on user behaviour: clicks, time spent on a movie page, or
              repeated searches.
          o   No direct input required.
How to Use Feedback?
1. Store Feedback in the Database
Add a new model in models.py:
from django.contrib.auth.models import User
from django.db import models
class MovieFeedback(models.Model):
  user = models.ForeignKey(User, on_delete=models.CASCADE)
  movie_title = models.CharField(max_length=255)
  liked = models.BooleanField() # True = Liked, False = Disliked
  timestamp = models.DateTimeField(auto_now_add=True)
The Movie Recommendation System developed using Machine Learning and Django
demonstrates the practical application of data science in the entertainment domain. By
leveraging content-based filtering techniques, the system effectively suggests relevant movies
to users based on their preferences, such as previously liked titles or selected genres. This
enhances the user experience by reducing the effort required to discover new content in an
ever-growing digital library of movies.
Machine learning plays a critical role in this project through the use of TF-IDF vectorization
and cosine similarity for text-based recommendation. This enables the system to capture the
contextual similarities between movies based on their descriptions or metadata, allowing for
intelligent and human-like suggestions. The integration of additional components such as a
genre classifier and chatbot further enriches the interaction, enabling dynamic and natural
user engagement.
On the web development front, Django provides a robust and scalable backend infrastructure,
making it possible to manage users, store feedback, and render movie suggestions efficiently.
The frontend, enhanced with Bootstrap and optional voice input or chatbot support, ensures
that the application is both responsive and user-friendly. This synergy between backend logic
and frontend interaction creates a seamless recommendation flow for users.
Throughout development, emphasis was placed not only on technical performance but also
on usability. Features like voice-based search, chatbot queries, and user feedback collection
significantly enhance personalization and accessibility. This makes the application suitable
for real-world deployment, especially in platforms like streaming services, where user
retention depends heavily on meaningful recommendations.
In conclusion, this project showcases a well-rounded integration of machine learning and web
technologies to solve a relevant and engaging problem. It serves as a strong foundation for
future enhancements, such as incorporating collaborative filtering, hybrid recommendation
models, and multi-language support. With growing demand for personalization in digital
content, systems like this continue to prove their value in real-world applications.
Limitations of the Project
   1. Cold Start Problem
       New users or movies without prior interaction or metadata have limited or no
       recommendations, as content-based filtering relies heavily on existing data.
   2. Lack of Personalization
       Without user-specific learning or collaborative filtering, recommendations are
       generalized and may not reflect individual user preferences over time.
   3. No Real-Time Learning
       The model does not update dynamically with user feedback or behavior, requiring
       manual retraining to incorporate new data or preferences.
   4. Limited Data Scope
       The dataset might only include metadata like titles and genres—lacking deep insights
       such as user reviews, ratings, or watch history.
   5. Text Similarity Constraints
       Content-based filtering using TF-IDF may miss deeper semantic connections between
       movies, as it doesn't fully understand narrative or context.
   6. Scalability Issues
       As the movie database grows, cosine similarity calculations become slower,
       potentially impacting performance on larger datasets.
   7. No Diversity in Results
       Recommendations tend to be similar to the input, leading to a filter bubble and
       reducing the discovery of varied or unexpected content.
   8. Limited UI/UX Functionality
       Features like voice input or chatbot might not work consistently across all browsers or
       devices, affecting accessibility for some users.
Future Enhancements
  1. Hybrid Recommendation System
     Combine content-based and collaborative filtering to improve both personalization
     and diversity in suggestions.
  2. Real-Time Feedback Learning
     Enable the system to update user profiles dynamically based on their likes, dislikes,
     and interactions for more accurate future recommendations.
  3. Deep Learning for NLP
     Replace TF-IDF with more powerful NLP models like BERT or Word2Vec for
     deeper semantic understanding of movie plots and descriptions.
  4. User-Based Collaborative Filtering
     Use user interaction data (ratings, watch history) to recommend movies liked by
     similar users, enabling better personalization.
  5. Genre and Actor-Based Filtering
     Add advanced filters so users can request movies by genre, actor, director, or release
     year more intuitively.
  6. Recommendation Explanations
     Show users why a movie was recommended (e.g., “because you liked Inception”),
     increasing trust in the system.
  7. Voice Command Integration
     Fully implement voice input for search and chatbot interaction, making the app more
     accessible.
  8. Mobile App Version
     Develop a mobile-friendly version or Android/iOS app for better reach and usability.
  9. User Dashboard and Watchlists
     Allow users to maintain watchlists, save favorite recommendations, and track viewing
     history.
  10. Sentiment Analysis on Reviews
     Analyze user reviews or social media sentiment to enrich recommendations with
     emotional tone and viewer satisfaction levels.
References
   1. Ricci, F., Rokach, L., & Shapira, B. (2015). Recommender Systems Handbook.
      Springer.
   2. Aggarwal, C. C. (2016). Recommender Systems: The Textbook. Springer.
   3. scikit-learn developers. (2024). scikit-learn: Machine Learning in Python.
      https://scikit-learn.org
   4. Django Software Foundation. (2024). Django Documentation.
      https://docs.djangoproject.com/
   5. IMDb Dataset. (2023). IMDb Movie Metadata. https://www.imdb.com/interfaces/
   6. TF-IDF Vectorizer. (n.d.). Scikit-learn TF-IDF Guide.
      https://scikit-learn.org/stable/modules/generated/sklearn.feature_extraction.text.Tfidf
      Vectorizer.html
   7. Cosine Similarity. (n.d.). SciPy Spatial Distance Metrics.
      https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.distance.cosine.html
   8. Medium. (2021). Content-Based Movie Recommendation Systems Using Python.
      https://medium.com
   9. Towards Data Science. (2022). Building a Simple Recommender System in Python.
      https://towardsdatascience.com
   10. GeeksforGeeks. (2023). Movie Recommendation using Cosine Similarity.
      https://www.geeksforgeeks.org
   11. OpenAI. (2023). Chatbot integration techniques and NLP. https://openai.com
   12. GitHub. (2024). Open-source Movie Recommendation Projects. https://github.com
   13.  Koren, Y., Bell, R., & Volinsky, C. (2009). Matrix Factorization Techniques for
       Recommender Systems. IEEE Computer, 42(8), 30–37.
   14.  Coursera. (2022). Recommender Systems Specialization – University of
       Minnesota. https://www.coursera.org/specializations/recommender-systems
   15.  Krishnan, S. (2020). Machine Learning for Personalized Recommendations.
       O'Reilly Media.
   16.  Papers With Code. (2024). State-of-the-Art Recommender System Benchmarks.
       https://paperswithcode.com/task/recommendation-systems
   17.  Microsoft Azure Blog. (2021). Building Recommender Systems with Azure
       Machine Learning. https://azure.microsoft.com/en-us/blog