AgriCast is a hybrid machine learning system for forecasting agricultural commodity prices using ensemble methods that combine SARIMA, LSTM, and XGBoost models.
AgriCast leverages multiple data sources and advanced machine learning techniques to predict agricultural commodity prices. The system integrates traditional time series analysis (SARIMA), deep learning (LSTM), and ensemble methods (XGBoost) to capture both linear and non-linear price patterns.
- Multi-source Data Collection: Automated scrapers for agricultural price data from multiple sources
- Hybrid Forecasting Model: Combines SARIMA, LSTM, and XGBoost for improved accuracy
- Comprehensive Evaluation: Metrics include MAE, RMSE, MAPE, and R²
- Flexible Data Processing: Handles missing data with interpolation and supports various time frequencies
- Modular Architecture: Clean separation of data collection, modeling, and evaluation
-
Clone the repository:
git clone https://github.com/PrakshaaleJain/AgriCast.git cd AgriCast -
Install dependencies:
pip install -r requirements.txt -
Set up environment variables:
Create a.envfile with the following:commodity_ID_path=path/to/your/commodity_ids.csv
- Scrape commodity and district IDs:
python ID_scraper/commodities_ids.py python ID_scraper/district_ids.py - Download historical price data:
python CEDA_scraper.py - Alternative web scraping:
python scraper.py
- Run the hybrid forecasting pipeline:
python train.py
- Evaluate model performance:
python metric.py
| Model | Purpose | Details |
|---|---|---|
| SARIMA | Linear trends & seasonality | Order (1,1,1), seasonal (1,1,1,12) |
| LSTM | Non-linear pattern learning | 2 layers, 64 hidden units |
| XGBoost | Ensemble of SARIMA and LSTM predictions | 400 estimators |
- CEDA (Centre for Economic Data and Analysis): Primary source for commodity prices
- FCA Info Web: Alternative source for retail price data
- Supported Commodities: Wheat, Rice, and others
- Geographic Coverage: District-level data across India
- pandas
- numpy
- matplotlib
- torch
- seaborn
- statsmodels
- scikit-learn
- xgboost
- scrapy
- selenium
- MAE (Mean Absolute Error)
- RMSE (Root Mean Square Error)
- MAPE (Mean Absolute Percentage Error)
- R² (Coefficient of Determination)
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
MIT License
- Support for more commodities
- Real-time API for price prediction
- Weather data integration
- Mobile app for farmers
- Advanced feature engineering
For questions or support, please open an issue on the GitHub repository.