Views
No views yet
| Property | Value |
|---|---|
| Model Type | Gradient Boosting Regressor |
| Framework | scikit-learn |
| Task | Tabular Regression |
| Target Variable | Revenue (continuous) |
| Training Platform | Microsoft Fabric + MLflow |
| Dataset | OJ Sales (Azure Open Datasets) |
| Sample Size | 500 rows (sampled with random_state=1) |
| Train/Test Split | 80/20 (random_state=42) |
| Feature | Type | Description |
|---|---|---|
Quantity | int | Units sold |
Advert | int | Advertisement flag (0=No, 1=Yes) |
Price | float | Unit price ($) |
Brand_encoded | int | Brand (0=Dominicks, 1=Minute Maid, 2=Tropicana) |
Store_encoded | int | Store ID (label encoded) |
Year | int | Year extracted from WeekStarting |
Month | int | Month (1-12) |
WeekOfYear | int | Week number (1-52) |
Quarter | int | Quarter (1-4) |
| Metric | Score |
|---|---|
| R² | 0.9965 |
| MAE | 358.00 |
| RMSE | 454.92 |
| CV R² (5-fold) | 0.9964 ± 0.0008 |
| Model | R² | MAE | RMSE |
|---|---|---|---|
| Gradient Boosting | 0.9965 | 358 | 455 |
| XGBoost | 0.9960 | 380 | 489 |
| Random Forest | 0.9952 | 412 | 533 |
| Linear Regression | 0.9474 | 1,835 | 2,450 |
1import pickle
2import numpy as np
3
4# Load model
5with open("model.pkl", "rb") as f:
6 model = pickle.load(f)
7
8# Input: [Quantity, Advert, Price, Brand_encoded, Store_encoded, Year, Month, WeekOfYear, Quarter]
9sample = np.array([[15000, 1, 2.50, 1, 5, 1992, 6, 24, 2]])
10prediction = model.predict(sample)
11print(f"Predicted Revenue: ${prediction[0]:,.2f}")Advert=1) shows positive impact on sales quantityn_estimators=200, learning_rate=0.1, max_depth=5, random_state=42