Box Office Revenue Prediction using Linear Regression Machine learning algorithm

In this Machine Learning project, we will predict Box office movie revenue using Linear Regression Machine Learning Algorithm.

Dataset Link: cost_revenue_clean.csv

Step-1: Importing Libraries and reading the given data.

import pandas
from pandas import DataFrame
import matplotlib.pyplot as plt
from sklearn.linear_model import LinearRegression

data = pandas.read_csv('cost_revenue_clean.csv')
data.describe()

Box Office Revenue Prediction using Linear Regression Machine learning algorithm

Step-2: Data Visualization

X = DataFrame(data, columns=['production_budget_usd'])
y = DataFrame(data, columns=['worldwide_gross_usd'])

plt.figure(figsize=(10,6))
plt.scatter(X, y, alpha=0.3)
plt.title('Film Cost vs Global Revenue')
plt.xlabel('Production Budget $')
plt.ylabel('Worldwide Gross $')
plt.ylim(0, 3000000000)
plt.xlim(0, 450000000)
plt.show()

Box Office Revenue Prediction using Linear Regression Machine learning algorithm

Step-3: Applying Linear Regression Model

regression = LinearRegression()
regression.fit(X, y)

plt.figure(figsize=(10,6))
plt.scatter(X, y, alpha=0.3)

# Adding the regression line here:
plt.plot(X, regression.predict(X), color='red', linewidth=3)

plt.title('Film Cost vs Global Revenue')
plt.xlabel('Production Budget $')
plt.ylabel('Worldwide Gross $')
plt.ylim(0, 3000000000)
plt.xlim(0, 450000000)
plt.show()

Box Office Revenue Prediction using Linear Regression Machine learning algorithmAlso read:

Leave a Reply

Your email address will not be published. Required fields are marked *