Skip to main content

Do You Have to Make a Good Movie to Make Money?

Machine learning
Python
Pulling movie data from the TMDB API to ask whether ratings and revenue move together, and what can actually be predicted.
Published

May 26, 2020

I wanted a media project and some practice pulling data from a public API, so I asked a simple question: is a movie’s rating related to how much money it makes, and can either one be predicted from what’s available before release?

What I did

  • Pulled about 134,000 movie records from the TMDB API and cleaned them down to about 28,000 usable films
  • Handled missing values with dropping and KNN imputation, then scaled and one-hot encoded features
  • Compared regression and classification models: linear, ridge, logistic, AdaBoost, random forest, gradient boosting, and k-nearest neighbors

What came out

Predicting exact revenue or exact rating went poorly. Predicting whether a film’s revenue would land above that year’s average worked much better, with test accuracy around 94%, though that number likely reflects some overfitting.

Technologies

Python pandas scikit-learn