Sales prediction using Linear Regression and Random Forest with advertising channel impact analysis.
Sales prediction using Linear Regression and Random Forest with advertising channel impact analysis.
- Total Records: 200
- Source: Kaggle — Advertising Dataset
- TV (Advertising Budget in thousands)
- Radio (Advertising Budget in thousands)
- Newspaper (Advertising Budget in thousands)
- Sales (Target Variable in thousands)
- Python
- Pandas
- NumPy
- Matplotlib
- Seaborn
- Scikit-Learn
- Data Loading
- Data Exploration
- Data Visualization
- Train-Test Split
- Model Training
- Model Evaluation & Comparison
- Actual vs Predicted Analysis
- Channel Impact Analysis
- Feature Importance Analysis
- New Sales Prediction
- Key Insights Summary
- Sales Distribution
- Advertising Budget Distribution
- Advertising Channels vs Sales Scatter Plots
- Correlation Heatmap
- Pairplot of All Features
- Actual vs Predicted Comparison Plot
- Channel Impact Bar Chart
- Feature Importance Bar Chart
Model 1: Linear Regression Model 2: Random Forest Regressor
- n_estimators = 100
- random_state = 42
| Metric | Linear Regression | Random Forest |
|---|---|---|
| R² Score | 89.94% | 98.13% |
| RMSE | 1.78 | 0.77 |
| MAE | 1.46 | 0.62 |
- TV Budget: $200,000
- Radio Budget: $40,000
- Newspaper Budget: $50,000
- Linear Regression Prediction: 19.63k units
- Random Forest Prediction: 20.26k units
- Random Forest outperformed Linear Regression (98.13% vs 89.94%)
- TV is the most impactful advertising channel on sales
- Newspaper has the least impact on sales
- Average sales across all records is 14.02k units
- Increasing TV budget has the strongest positive effect on sales
- Radio shows moderate correlation with sales
- Clone this repository
- Install required libraries:
pip install pandas numpy matplotlib seaborn scikit-learn- Open the notebook in Jupyter:
jupyter notebook sales_prediction.ipynb- Run all cells sequentially
Shreyansh Gupta B.Tech (CSDS) — Galgotias College of Engineering & Technology