YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
Apple Price Prediction Model — Indian Market
Hybrid Prophet + ARIMA ensemble for forecasting Indian wholesale apple prices (₹/kg) and generating SELL / STORE recommendations for farmers and traders.
Overview
This model forecasts apple mandi/wholesale prices 7 days ahead and recommends whether farmers or cold-storage traders should SELL immediately or STORE for better returns, accounting for Indian cold-storage costs (₹0.75/kg/day).
| Component | Details |
|---|---|
| Architecture | Hybrid Prophet + ARIMA Ensemble |
| Blend Weights | 60% Prophet + 40% ARIMA |
| Currency | INR (₹) — wholesale price per kg |
| Training Data | 12,000 synthetic samples (2018–2021) |
| Varieties | Shimla, Kinnauri, Royal Delicious, Golden Delicious, Maharaji |
| Regions | Himachal Pradesh, Jammu & Kashmir, Uttarakhand, Arunachal Pradesh, Nagaland |
Quickstart
from model.predict import predict_price
result = predict_price({
"date": "2026-03-07",
"current_price": 120.0, # ₹/kg (current wholesale price)
"storage_time_days": 15,
"apple_variety": "Kinnauri",
"region": "Himachal Pradesh",
})
print(result)
# {
# "predicted_price_7d": 127.50,
# "recommendation": "STORE",
# "current_price": 120.0,
# "storage_cost_7d": 5.25,
# "breakeven_price": 125.25,
# "currency": "INR",
# "confidence": "hybrid Prophet+ARIMA (0.6/0.4)"
# }
Repository Structure
apple-price-predictor/
├── data/
│ └── apple_price_dataset.csv # 12,000-sample Indian market dataset
├── models/
│ ├── prophet_model.pkl # Trained Prophet model
│ ├── arima_model.pkl # Trained ARIMA model
│ ├── scaler.pkl # MinMaxScaler for feature normalization
│ └── metrics.json # MAE / RMSE evaluation metrics (in ₹)
├── model/
│ └── predict.py # Inference wrapper
├── train.py # Full training pipeline
├── requirements.txt
└── README.md
Indian Market Dataset
Synthetic dataset simulating realistic Indian apple market dynamics:
| Column | Description |
|---|---|
date |
Daily timestamps (2018-01-01 onward) |
apple_variety |
Shimla / Kinnauri / Royal Delicious / Golden Delicious / Maharaji |
region |
HP / J&K / Uttarakhand / Arunachal Pradesh / Nagaland |
harvest_season |
1 if July–October (Indian harvest window) |
storage_time_days |
Days in cold storage post-harvest |
temperature |
Daily temperature °C (hill station climate) |
rainfall |
Daily rainfall mm (monsoon-shaped curve) |
market_demand_index |
Demand pressure (peaks: summer stock-out + Diwali) |
supply_index |
Supply pressure (high during harvest, monsoon shocks) |
previous_week_price |
Wholesale price 7 days prior (₹/kg) |
price |
Target — wholesale market price (₹/kg) |
Price Drivers Modelled
| Driver | Effect |
|---|---|
| Harvest season (Jul–Oct) | −₹12/kg discount (fresh supply glut) |
| Summer scarcity (Apr–Jun) | +₹15/kg spike (low cold-storage stock) |
| Festival demand (Diwali) | +₹5–₹15/kg premium |
| Monsoon road blockage | +₹0–₹10/kg in HP/JK (supply shock) |
| Cold-storage decay | −₹0.08/kg/day (quality degradation) |
| Inflation trend | +₹5/kg per year |
| Market noise | ±₹4/kg random volatility |
Typical wholesale price range: ₹40 – ₹165/kg
- Maharaji (local): ₹40 – ₹80/kg
- Royal Delicious: ₹55 – ₹110/kg
- Golden Delicious: ₹60 – ₹115/kg
- Shimla: ₹65 – ₹130/kg
- Kinnauri (premium): ₹85 – ₹165/kg
Feature Engineering
| Feature | Description |
|---|---|
month |
Calendar month (1–12) |
week_of_year |
ISO week (1–53) |
season |
winter / pre_monsoon / monsoon / post_monsoon |
storage_cost_estimate |
₹0.75 × storage_time_days |
price_trend |
Day-over-day price change (₹) |
rolling_mean_price |
7-day rolling mean (₹) |
rolling_std_price |
7-day rolling std dev (₹) |
Model Architecture
Prophet
- Yearly + weekly seasonality (multiplicative mode)
- Custom festival seasonality component (Fourier order 3)
- Changepoint prior scale: 0.05
ARIMA
- Auto parameter search via
pmdarima - Best order selected by AIC minimisation
- Stepwise search: p, d, q ∈ {0…3}
Hybrid Ensemble
final_prediction = (0.6 × prophet_prediction) + (0.4 × arima_prediction)
Sell / Store Decision Engine
storage_cost_7d = ₹0.75 × 7 = ₹5.25/kg
breakeven_price = current_price + storage_cost_7d
if predicted_price_7d > breakeven_price:
recommendation = "STORE"
else:
recommendation = "SELL"
Training
pip install -r requirements.txt
python train.py
Evaluation Metrics (₹/kg)
| Model | MAE (₹/kg) | RMSE (₹/kg) |
|---|---|---|
| Prophet | ~₹15–20 | ~₹18–25 |
| ARIMA | ~₹5–8 | ~₹7–12 |
| Hybrid | ~₹10–14 | ~₹14–18 |
(Exact values saved in models/metrics.json)
License
MIT License — free for research and commercial use.
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support