kendrickfff/OJ-Sales-Revenue-Prediction
0
OJ Sales ๐ Revenue Prediction (Gradient Boosting)
A Gradient Boosting Regressor trained on the OJ Sales dataset from Azure Open Datasets to predict orange juice Revenue based on sales features.
Built and deployed on Microsoft Fabric during METC Online Training #5: "Mempersiapkan Data untuk Model AI di Microsoft Fabric" ๐ organized by Microsoft Elevate and Dicoding.
Model Details
Features (9)
Performance
Best Model: Gradient Boosting
All Models Compared
Usage
import pickle
import numpy as np
# Load model
with open("model.pkl", "rb") as f:
model = pickle.load(f)
# Input: [Quantity, Advert, Price, Brand_encoded, Store_encoded, Year, Month, WeekOfYear, Quarter]
sample = np.array([[15000, 1, 2.50, 1, 5, 1992, 6, 24, 2]])
prediction = model.predict(sample)
print(f"Predicted Revenue: ${prediction[0]:,.2f}")Key Insights
- Quantity and Price are the dominant predictors of Revenue
- Advertising (
Advert=1) shows positive impact on sales quantity - Ensemble models significantly outperform Linear Regression
- Model is highly stable with CV std of only 0.0008
Training Details
- Hyperparameters:
n_estimators=200,learning_rate=0.1,max_depth=5,random_state=42 - Cross-Validation: 5-fold with Rยฒ scoring
- Experiment Tracking: MLflow on Microsoft Fabric
- Deployment: Real-time API endpoint on Microsoft Fabric
Acknowledgments
- Microsoft Elevate and Dicoding for organizing METC Online Training #5
- Azure Open Datasets ๐ for providing the OJ Sales dataset
