Predict whether your movie will be a HIT or FLOP using Deep Learning!
An AI-powered movie success prediction system that uses BERT transformers and multi-task deep learning to predict:
- Hit/Flop Classification (success probability)
- Box Office Revenue (predicted earnings)
- Profit/Loss (financial outcome including negative profits)
- ROI (return on investment)
- State-of-the-art NLP: Uses DistilBERT (66M parameters) for understanding movie plots
- Multi-task Learning: Predicts 3 outputs simultaneously for better accuracy
- Handles Losses: Uses signed log transformation to predict negative profits
- No Data Leakage: Classification based on ratings, not revenue
- Production Ready: Includes Gradio web interface for deployment
- Comprehensive Evaluation: Full metrics, visualizations, and diagnostics
| Metric | Score |
|---|---|
| Classification Accuracy | ~75-80% |
| Revenue R² Score | ~0.40-0.60 |
| Profit R² Score | ~0.40-0.60 |
| ROC-AUC | ~0.68 |
Note: Movie success prediction is inherently uncertain due to factors like marketing, timing, and audience reception that aren't in the data.
┌─────────────────────────────────────────────────────────────┐
│ INPUT │
│ Text: "Movie plot... Directed by X" │
│ Numeric: [Budget, Popularity, Runtime, Genres, Votes] │
└────────────────────┬────────────────────────────────────────┘
│
┌───────────┴───────────┐
│ │
┌────▼─────┐ ┌──────▼──────┐
│ BERT │ │ Dense │
│ (768D) │ │ Layers │
└────┬─────┘ └──────┬──────┘
│ │
┌────▼─────┐ ┌──────▼──────┐
│ Dense256 │ │ Dense64 │
│ Dense128 │ │ Dense32 │
└────┬─────┘ └──────┬──────┘
│ │
└───────────┬──────────┘
│
┌──────▼──────┐
│ Shared │
│ Dense128 │
│ Dense64 │
└──────┬──────┘
│
┌───────────┼───────────┐
│ │ │
┌────▼────┐ ┌───▼────┐ ┌───▼────┐
│ Hit/Flop│ │Revenue │ │ Profit │
│(Sigmoid)│ │(Linear)│ │(Linear)│
└─────────┘ └────────┘ └────────┘
Key Components:
- Text Encoder: DistilBERT (distilbert-base-uncased)
- Numeric Branch: StandardScaler + Dense layers
- Multi-task Head: 3 output branches with different loss functions
- Total Parameters: ~67M
Python 3.8+
CUDA-capable GPU (optional, for faster training)# Clone the repository
git clone https://github.com/yourusername/movie-success-predictor.git
cd movie-success-predictor
# Install dependencies
pip install -r requirements.txtDownload the TMDb 5000 Movie Dataset:
Place them in the project root directory.
# Run training script
python train.py
# Or use the Jupyter notebook
jupyter notebook Movie_Success_Predictor.ipynbfrom predict import predict_new_movie
result = predict_new_movie(
model=model,
tokenizer=tokenizer,
title="Avengers: Endgame",
overview="The Avengers assemble for a final battle against Thanos",
budget=356_000_000,
popularity=150,
runtime=181,
genre_count=3,
vote_count=15000
)
print(f"Classification: {result['classification']}")
print(f"Predicted Revenue: ${result['predicted_revenue']:,.0f}")
print(f"Predicted Profit: ${result['predicted_profit']:,.0f}")Launch the Gradio web app:
python app.pyOr deploy instantly in Google Colab:
!pip install gradio
import gradio as gr
# ... (load model) ...
demo = gr.Interface(...)
demo.launch(share=True) # Creates public URL!Demo Features:
- Mobile-friendly
- Real-time predictions
- Detailed financial forecasts
- Investment recommendations
movie-success-predictor/
│
├── data/
│ ├── tmdb_5000_movies.csv # Movie dataset
│ └── tmdb_5000_credits.csv # Credits dataset
│
├── models/
│ ├── movie_model_best.pth # Trained model weights
│ ├── scalers.pkl # Feature scalers
│ └── tokenizer/ # BERT tokenizer
│
├── notebooks/
│ └── Movie_Success_Predictor.ipynb # Training notebook
│
├── src/
│ ├── train.py # Training script
│ ├── evaluate.py # Evaluation script
│ ├── predict.py # Prediction functions
│ └── model.py # Model architecture
│
├── app.py # Gradio web interface
├── requirements.txt # Dependencies
├── README.md # This file
└── LICENSE # MIT License
**Feature Engineering:**
```python
# Label: Based on ratings (no data leakage)
label = 1 if vote_average >= 7.0 else 0
# Signed log for profit (handles negative values)
def signed_log(x):
return np.sign(x) * np.log1p(np.abs(x))
# Log transform for revenue
log_revenue = np.log1p(revenue)
Scaling:
- Numeric features:
StandardScaler(zero mean, unit variance) - Revenue target:
MinMaxScaleron log-transformed values - Profit target:
MinMaxScaleron signed-log values
loss = (10.0 * BCE_loss_classification +
1.0 * MSE_loss_revenue +
1.0 * MSE_loss_profit)Why weighted?
- Classification loss is weighted higher (10x) to ensure the model doesn't ignore it
- Revenue and profit use MSE for continuous prediction
- Optimizer: AdamW (learning_rate=2e-5, weight_decay=0.01)
- Scheduler: Linear warmup (10% of steps) + decay
- Early Stopping: Patience=5 epochs
- Gradient Clipping: max_norm=1.0
precision recall f1-score support
Flop 0.76 0.95 0.84 492
Hit 0.65 0.28 0.39 154
accuracy 0.75 646
Revenue Prediction:
- MAE: ~$50-80M
- RMSE: ~$100-150M
- R²: ~0.40-0.60
Profit Prediction:
- MAE: ~$40-70M
- RMSE: ~$90-140M
- R²: ~0.40-0.60
Run evaluation to generate:
- Confusion matrix
- ROC curve
- Revenue/profit scatter plots
- Residual plots
- Error distributions
python evaluate.py- Studio Executives: Evaluate script potential before greenlight
- Producers: Estimate budget and revenue expectations
- Investors: Assess financial risk and ROI
- Film Students: Learn about factors affecting movie success
- Data Scientists: Study multi-task deep learning architecture
# In train.py, add to num_cols:
num_cols = ['budget', 'popularity', 'runtime', 'genre_count',
'vote_count', 'release_month', 'sequel_flag'] # Add these# Default: 0.5
optimal_threshold = 0.4 # Lower threshold for more HIT predictions
label = 1 if probability >= optimal_threshold else 0# Increase classification importance
LOSS_WEIGHTS = {
'class': 15.0, # Higher = more focus on hit/flop
'revenue': 1.0,
'profit': 1.0
}- Add temporal features (release date, seasonality)
- Include marketing budget and social media metrics
- Implement ensemble methods (combine with XGBoost)
- Fine-tune BERT layers instead of freezing
- Add genre-specific models
- Predict opening weekend separately
- Include international box office
- Add interpretability (SHAP values, attention visualization)
Cause: Class imbalance (76% flops)
Solution:
# Use Focal Loss or adjust threshold
optimal_threshold = 0.3 # Instead of 0.5Cause: Independent prediction of profit and revenue
Solution:
# Calculate profit from revenue
pred_profit = pred_revenue - budgetCause: Double exponential or wrong scaler
Solution: Check scalers are fitted on log-transformed values
scaler_revenue.fit(df['log_revenue']) # NOT df['revenue']Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
If you use this project in your research, please cite:
@misc{movie_success_predictor,
author = Subhadeep Das,
title = {Movie Success Predictor: Multi-task Deep Learning for Box Office Prediction},
year = {2025},
publisher = {GitHub},
url =
}- Dataset: TMDb 5000 Movie Dataset from Kaggle
- BERT: DistilBERT by Hugging Face
- Framework: PyTorch
- UI: Gradio
- Inspiration: Movie industry analytics and box office prediction research
Subhadeep Das - @subhadeepd18@gmail.com
PREDICTION FOR: 'Avatar: The Way of Water'
================================================
Classification: Hit
Probability: 92.3%
Confidence: Very Strong
Financial Forecast:
Budget: $350,000,000
Predicted Revenue: $2,304,567,890
Predicted Profit: $1,954,567,890
Performance Metrics:
ROI: 558.4%
Profit Margin: 84.8%
Success Ratio: 6.58x
Recommendation:
STRONG BUY - High success probability with excellent returns


