GithubHelp home page GithubHelp logo

ppai22 / contribution-of-characters-to-the-mcu Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 1.0 18 KB

This project calculates the contribution of each character to the Marvel Cinematic Universe in terms of how much time they spend on screen. The TF-IDF ranking algorithm is used here for the purpose.

License: MIT License

Python 100.00%
marvel data-science tf-idf

contribution-of-characters-to-the-mcu's Introduction

Contribution Of Characters To The MCU

This project calculates the contribution of each character to the Marvel Cinematic Universe in terms of how much time they spend on screen. The TF-IDF ranking algorithm is used here for the purpose.

Requirements

  • Python version: 3.7.4
  • Python modules: bs4, requests, collections, pandas, numpy, re

Idea

  • The main idea here was to find out how much screen time each character has faced in relation to the entire Marvel Cinematic Universe. The movies covered here are only those that are part of the Infinity Saga.
  • The TF-IDF algorithm is used to rank the characters based on their screen time.
  • In the traditional sense, TF-IDF is used to rank the relevance of documents based on the term frequencies. Here, I have altered the algorithm to incorporate screen time of characters
  • TF = Time spent by character in a movie / Total running length of the movie
  • IDF = Total number of movies considered / natural_log(Number of movies the character appears in)
  • A result sheet is generated, where TF-IDF scores for each character has been calculated considering his/her movies only, and the entire MCU

Steps

  • Just run mcu.py to generate the results.
  • characters.csv file needs to be placed in the same directory
  • Three CSV files - character_screen_time_every_movie.csv: Matrix with each character's screen time for each movie, character_tf_idf_every_movie.csv: TF-IDF scores for each character over each movie, and character_tf_idf_mcu_contribution.csv: Mean TF-IDF scores calculated for each character over all his/her movies, and over the entire MCU - are generated in the same directory.

Further work to be done

  • Visualisation of the data in some graphical format using matplotlib or bokeh.
  • Understanding the results clearly (I'm really interested in what these values really mean)
  • Maybe a written analysis of the results as a blog post (hopefully)

Data for the analysis obtained from IMDB created by ninewheels0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.