{"id":31698861,"url":"https://github.com/rasoulameri/river_discharge_regression","last_synced_at":"2026-04-29T16:02:35.594Z","repository":{"id":318476988,"uuid":"1071442519","full_name":"rasoulameri/River_Discharge_Regression","owner":"rasoulameri","description":"A hybrid machine learning framework for river discharge forecasting that combines ensemble regression models with the Arithmetic Optimization Algorithm (AOA) for hyperparameter tuning and next-day flow prediction.","archived":false,"fork":false,"pushed_at":"2025-10-07T11:13:59.000Z","size":4300,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-07T13:19:31.284Z","etag":null,"topics":["correlation","forecasting","hybrid","lag","machine-learning","mean-square-error","optimization","prediction","regression","regression-models","river-discharge","scatter-plot","sklearn","svm","time-series","time-series-analysis","time-series-forecast","time-series-forecasting","time-series-prediction","voting-regressor"],"latest_commit_sha":null,"homepage":"https://www.linkedin.com/in/rasoulameri/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rasoulameri.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-07T11:02:38.000Z","updated_at":"2025-10-07T11:41:35.000Z","dependencies_parsed_at":"2025-10-07T13:32:18.979Z","dependency_job_id":null,"html_url":"https://github.com/rasoulameri/River_Discharge_Regression","commit_stats":null,"previous_names":["rasoulameri/river_discharge_regression"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/rasoulameri/River_Discharge_Regression","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rasoulameri%2FRiver_Discharge_Regression","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rasoulameri%2FRiver_Discharge_Regression/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rasoulameri%2FRiver_Discharge_Regression/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rasoulameri%2FRiver_Discharge_Regression/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rasoulameri","download_url":"https://codeload.github.com/rasoulameri/River_Discharge_Regression/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rasoulameri%2FRiver_Discharge_Regression/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32432917,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T13:34:34.882Z","status":"ssl_error","status_checked_at":"2026-04-29T13:34:29.830Z","response_time":110,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["correlation","forecasting","hybrid","lag","machine-learning","mean-square-error","optimization","prediction","regression","regression-models","river-discharge","scatter-plot","sklearn","svm","time-series","time-series-analysis","time-series-forecast","time-series-forecasting","time-series-prediction","voting-regressor"],"created_at":"2025-10-08T19:11:19.696Z","updated_at":"2026-04-29T16:02:35.575Z","avatar_url":"https://github.com/rasoulameri.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 💧 River Discharge Forecasting using Machine Learning and AOA Optimization\n\n\u003e **An intelligent framework for river discharge forecasting using ensemble regression models optimized by the Arithmetic Optimization Algorithm (AOA).**  \n\u003e The dataset is prepared with **lag features** to forecast **next-day discharge**, but the framework can be easily adapted to other time series forecasting tasks.\n\n---\n\n## 🧠 Overview\n\nThis project integrates **machine learning regression models** (GBR, SVR, KNN, Voting Regressor)  \nwith the **Arithmetic Optimization Algorithm (AOA)** to optimize model parameters and ensemble weights.  \nIt is designed to predict **tomorrow’s river discharge** based on historical flow data, but users can replace the dataset to apply it to any regression or forecasting problem.\n\nThe framework automatically:\n1. Loads and preprocesses data  \n2. Splits into training, validation, and test sets  \n3. Trains multiple regression models  \n4. Optimizes ensemble weights and hyperparameters using **AOA**  \n5. Evaluates models using multiple metrics (R², RMSE, MAE, MSE)  \n6. Produces visual outputs and exports all results\n\n---\n\n## 📊 Example Dataset\n\nThe provided example uses **river discharge data**, but users can replace it with any numerical dataset.  \nTo use your own data:\n1. Place your file in the `./data/` directory.\n2. Update the filename and sheet names in `config/setting.yaml`.\n3. Run the main script again.\n\n---\n\n## ⚙️ Configuration (config/setting.yaml)\n\nAll parameters can be controlled from the configuration file.\n\n```yaml\ndata:\n  name: \"station1\"\n  path: \"./data/station1.xlsx\"\n  sheet_range: [1, 5]\n\ntrain:\n  split:\n    train_end: 2577\n    valid_end: 3105\n  batch_size: 32\n  epochs: 50\n\noptimization:\n  method: \"AOA\"\n  population_size: 100\n  epochs: 100\n  alpha: 5\n  miu: 0.5\n  moa_min: 0.2\n  moa_max: 0.9\n\nresults:\n  metrics_dir: \"./results/metrics/\"\n  predictions_dir: \"./results/predictions/\"\n  plots_dir: \"./results/prediction_plots/\"\n```\n\n---\n\n## 🧩 Workflow\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"./docs/flowchart.png\" width=\"75%\"\u003e\n\u003c/p\u003e\n\n**Workflow Summary:**\n\n1. **Data Loading \u0026 Normalization** using MinMaxScaler\n2. **Base Regressors:** Gradient Boosting, SVR, KNN\n3. **Ensemble:** Voting Regressor\n4. **Optimization:** AOA for weight and hyperparameter tuning\n5. **Evaluation:** Compute R², RMSE, MAE, MSE\n6. **Visualization:** Scatter plots, violin plots, and time-series comparisons\n\n---\n\n## 📈 Visual Outputs\n\n| Type | Description | Example |\n|------|-------------|---------|\n| **Scatter Plots** | Predicted vs True values for all models | \u003cimg src=\"./results/prediction_plots/scatter.png\" width=\"400\"\u003e |\n| **Violin Plot** | Distribution of model predictions | \u003cimg src=\"./results/prediction_plots/violin.png\" width=\"400\"\u003e |\n| **Time Series** | Comparison of predicted and true values over time | \u003cimg src=\"./results/prediction_plots/time_series.png\" width=\"400\"\u003e |\n\n---\n\n## 🧾 Results\n\nAll results (metrics, predictions, and visualizations) are automatically saved to:\n\n```\nresults/\n│\n├── metrics/             # R², RMSE, MAE, MSE summary\n├── predictions/         # Excel files with model outputs\n└── prediction_plots/    # All generated plots\n```\n\nEach file is named according to the dataset and scenario defined in the configuration file.\n\n---\n\n## 📦 Installation\n\n```bash\ngit clone https://github.com/rasoulameri/River_Discharge_Regression.git\ncd River_Discharge_Regression\npip install -r requirements.txt\n```\n\n---\n\n## ▶️ Usage\n\nTo run the framework:\n\n```bash\npython main.py\n```\n\nor for Jupyter visualization:\n\n```bash\njupyter notebook notebooks/EDA_and_Visualization.ipynb\n```\n\n---\n\n## 🧠 Example Models\n\n| Model | Description |\n|-------|-------------|\n| **GBR** | Gradient Boosting Regressor |\n| **SVR** | Support Vector Regressor |\n| **KNN** | k-Nearest Neighbors Regressor |\n| **VR** | Ensemble Voting Regressor |\n| **AOA_VR** | AOA-tuned ensemble with optimal hyperparameters |\n\n\n---\n\n## 📄 Data Availability Statement\n\nThe raw data used in this project (river discharge samples) are provided for demonstration. Users are encouraged to replace them with their own datasets.\n\n---\n\n## 🏗 Repository Structure\n\n```\nRiver_Discharge_Regression/\n│\n├── config/\n│   └── setting.yaml                # Main configuration\n│\n├── data/\n│   └── River_Discharge.xlsx        # Example dataset\n│\n├── src/\n│   ├── models.py\n│   ├── data_loader.py\n│   ├── evaluate.py\n│   ├── optimization.py\n│   └── train.py\n│\n├── results/\n│   ├── metrics/\n│   ├── predictions/\n│   └── prediction_plots/\n│\n├── requirements.txt\n│\n└─ main.py\n```\n\n---\n\n## 📫 Contact\n\n**Rasoul Ameri**  \n📧 [rasoulameri90@gmail.com](mailto:rasoulameri90@gmail.com)  \n🔗 [GitHub Profile](https://github.com/rasoulameri)\n\n---\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frasoulameri%2Friver_discharge_regression","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frasoulameri%2Friver_discharge_regression","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frasoulameri%2Friver_discharge_regression/lists"}