Skip to content

A Hybrid Recommendation model based on sentiment analysis on tweets and item based filtering to closely match preferred recommendation.

License

Notifications You must be signed in to change notification settings

3ZadeSSG/ContentBased-Movie-Recommendation-using-Sentiment-Analysis

Repository files navigation

License: MIT

ContentBased-Movie-Recommendation-using-Sentiment-Analysis

This repo contains a Hybrid Recommender System developed in PyTorch. The App is used to recommend movies beased on user likes, show twitter sentiment based on search string (to cross check sentiment analysis resutls on trends), show sentiment prediction of a sentence

Quick Setup Guide

  • The Sentiment Analysis Model checkpoint file is large and cannont be loaded to this repo. To generate your own trained model, run the notebook of Folder: 2. Training with Preprocessed Data since the data preprocessing takes longer, hence preprocessed data have been saved there. To utilize the GPU you need to load the notebook on Google Colab.

  • To create the rating database form tweets, you need to create your own Twitter API Key, and then initialize the following variables in TwitterAnalyzer.py placed in "3. Google Cloud Deployment folder"

            consumer_key = 
            consumer_secret = 
            access_token = 
            access_token_secret = 
    

Then calling *getTwitterSentiment(SearchString)" will return the percentage of positive tweets about the search string.

  • To load the details about movie and posters you need OMDB API Key and initialize the variables of following files

          omdbAPIKEY="" //movieRecommendorOnUserData.py (Folder 3)
          String APIKEY = ""; //MovieRatingSearchFragment.java (Folder 4)
    
  • To load the trending page of Explore Fragment in Android app, you need themoviedb API Key

         String APIKEY=""; //ExploreFragment.java (Folder 4)
    

Proposed Model

Creating the rating database is possible on production environment, but the twitter analyzer model have been implemented to be used there. The purposed model has been shown in following figure.

1. Based on user likes, generate list of recommended movies using traditional content based filtering method.

2. For each movie in database, the rating for that movie needs to be generated.

3. For each movie, analyze the tweets by passing it to sentiment prediction model and generate the percentage of positive results as rating.

4. For each recommended movie, use it’s rating score to fuse it with rating of movies liked by user.

5. Movies with highest score will be considered for recommendation.

Final System

Google Cloud App Engine Deployment

Client can use the API methods to call the server to get respone, the API methods are defined in Folder 3. Google Cloud Deployment inside main.py file. To deploy the model, paste your sentiment analysis checkpoint file into the Folder 3.Google Cloud Deployment and run the following command form termial:

> gcloud app deploy

An example of output when deploying the app in my case:

      F:\MajorProject\3. Google Cloud Deployment of Model with Recommendation System Code>gcloud app deploy
Services to deploy:

descriptor:      [F:\MajorProject\3. Google Cloud Deployment of Model with Recommendation System Code\app.yaml]
source:          [F:\MajorProject\3. Google Cloud Deployment of Model with Recommendation System Code]
target project:  [major-project-final-246818]
target service:  [default]
target version:  [20190724t221233]
target url:      [https://major-project-final-246818.appspot.com]


Do you want to continue (Y/n)?

After your own app has been deployed you need to replace the API Urls from Android Java files with your own API urls. Which means "https://major-project-final-246818.appspot.com" with your own generated url.

Video Walkthrough

User Logs In and likes a movie which gets saved in database User gets recommended movie on recommendations page Twitter Analyzer to demonstrate that it can be used to create the rating database

Additional Screenshots

Liking a movie Disliking a movie Navigation Drawer

About

A Hybrid Recommendation model based on sentiment analysis on tweets and item based filtering to closely match preferred recommendation.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published