Data Science in Entertainment: Predicting Movie Revenue
Data science in entertainment gets most of its attention for recommendations, but a more basic use is forecasting revenue and understanding risk. This article uses 3,201 films from a public dataset to answer three questions with real numbers: how often do films lose money, does a higher rating mean a bigger gross, and how much of a film’s revenue can a model predict before release? Analysis used pandas 3.0.5 and scikit-learn 1.9.1.

The data
The file is movies.json from the open vega-datasets collection: 3,201 films with production budget, US and worldwide gross, IMDB rating and votes, genre and distributor. After dropping films with a missing or zero budget or gross, 3,146 remain; 2,955 of them also have an IMDB rating. Release dates in the file include impossible values (years up to 2046), so we did not use release year. Grosses are not adjusted for inflation, and budgets exclude marketing, so ratios are rough.
import pandas as pd
m = pd.read_json('movies.json')
k = m.dropna(subset=['Worldwide Gross', 'Production Budget'])
k = k[(k['Production Budget'] > 0) & (k['Worldwide Gross'] > 0)]
k = k.assign(roi=k['Worldwide Gross'] / k['Production Budget'])
print((k.roi < 1).mean()) # 0.335
print(k.roi.median(), k.roi.mean()) # 1.86 11.73Many films lose money, and averages mislead
Gross below budget happened for 33.5% of films. The median film grossed 1.86 times its budget, but the mean was 11.73, pulled up by extreme outliers: Paranormal Activity (budget $15,000, worldwide gross $193.8 million, a ratio of about 12,900) is the top. Use the median, not the mean, when describing a typical film. The share of money-losers did not fall steadily with budget: 31.8%, 34.4%, 39.7%, 37.5% and 24.0% from the smallest to the largest budget fifth. The big-budget group lost money least often, though this file does not show why, and it counts only films that were released and recorded.
Genre matters
| Genre (30+ films) | Films | Median gross/budget | Share below budget |
|---|---|---|---|
| Musical | 49 | 2.76 | 31% |
| Horror | 207 | 2.69 | 20% |
| Adventure | 250 | 2.31 | 20% |
| Action | 392 | 2.06 | 28% |
| Comedy | 630 | 1.90 | 33% |
| Drama | 733 | 1.38 | 42% |
| Western | 35 | 1.06 | 46% |
Horror had the highest median ratio among the large groups and only 20% money-losers, while drama had a median of 1.38 and 42% below budget. Cheap horror films have a long history of strong ratios; this table shows the pattern in this dataset, not a rule for any particular film.
Does a better rating mean more revenue?
Only weakly. On the 2,955 films with a rating, the correlation between IMDB rating and the log of worldwide gross was 0.14; with log gross-to-budget ratio it was 0.24. Budget was a far stronger signal: the correlation between log budget and log gross was 0.64, since expensive films get wide releases. Ratings arrive after release too, so they would not be available for a pre-release forecast.
How much revenue can a model predict?
from sklearn.linear_model import LinearRegression
from sklearn.model_selection import cross_val_score, KFold
cv = KFold(5, shuffle=True, random_state=0)
# target: log of worldwide gross
cross_val_score(LinearRegression(), X[['lb']], y, cv=cv).mean() # budget only| Features (5-fold cross-validated R²) | R² |
|---|---|
| Log budget only | 0.407 |
| + IMDB rating | 0.439 |
| + log IMDB votes | 0.540 |
| Gradient boosting on all three | 0.577 |
Budget alone explains about 41% of the variation in log gross. Votes help most (0.54) but are only known after release, so that model shows what is related to success rather than what you could forecast beforehand. A boosting model got 0.577. Even the best of these leaves nearly half of the variation unexplained, which is why film revenue is notoriously hard to predict.
Where this fits
Studios and streamers use the same ideas with far richer data: audience tests, cast and genre history, marketing spend and platform viewing data. For recommendation methods see our guide to a recommendation system with Python; for model basics see linear regression and random forests, and the industry overview data science by industry. The scikit-learn cross-validation guide explains the scoring used above.
Limits of this analysis
The dataset mixes decades with unadjusted money, has data-quality problems in dates, excludes marketing costs and later income such as streaming and DVD, and covers only films that made it into the file. Correlations are not causes.
FAQ
How is data science used in entertainment?
For recommendations, audience analysis, revenue and risk forecasting, and marketing. This article covers risk and revenue using real film data.
What share of films lose money?
In this dataset, 33.5% grossed less than their production budget. Marketing costs are not included, so the true share is probably higher.
Does IMDB rating predict box office?
Only weakly here: correlation 0.14 with the log of worldwide gross.
Can a model predict a movie’s gross?
Partly. Budget alone explained 41% of the variation in log gross, and the best model 58%.
