{"id":28191986,"url":"https://github.com/dennismgoetz/ma_predicting_shapley_values","last_synced_at":"2025-08-04T06:13:13.996Z","repository":{"id":289287588,"uuid":"790404850","full_name":"dennismgoetz/MA_predicting_Shapley_values","owner":"dennismgoetz","description":"Implementation part of my master thesis \"Predicting Shapley values in routing problems with machine learning\"","archived":false,"fork":false,"pushed_at":"2025-04-22T13:54:08.000Z","size":32705,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-23T22:32:51.521Z","etag":null,"topics":["dbscan-clustering","deep-neural-networks","kernel-machines","multilayer-perceptron","regression-models","shapley-value","supervised-machine-learning","travelling-salesman-problem","xgboost"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","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/dennismgoetz.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}},"created_at":"2024-04-22T20:21:52.000Z","updated_at":"2025-04-22T14:11:20.000Z","dependencies_parsed_at":"2025-04-22T14:54:32.183Z","dependency_job_id":null,"html_url":"https://github.com/dennismgoetz/MA_predicting_Shapley_values","commit_stats":null,"previous_names":["dennismgoetz/ma_predicting_shapley_values"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dennismgoetz/MA_predicting_Shapley_values","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dennismgoetz%2FMA_predicting_Shapley_values","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dennismgoetz%2FMA_predicting_Shapley_values/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dennismgoetz%2FMA_predicting_Shapley_values/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dennismgoetz%2FMA_predicting_Shapley_values/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dennismgoetz","download_url":"https://codeload.github.com/dennismgoetz/MA_predicting_Shapley_values/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dennismgoetz%2FMA_predicting_Shapley_values/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268657139,"owners_count":24285441,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-04T02:00:09.867Z","response_time":79,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["dbscan-clustering","deep-neural-networks","kernel-machines","multilayer-perceptron","regression-models","shapley-value","supervised-machine-learning","travelling-salesman-problem","xgboost"],"created_at":"2025-05-16T11:11:30.091Z","updated_at":"2025-08-04T06:13:13.964Z","avatar_url":"https://github.com/dennismgoetz.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Predicting Shapley values in routing problems with machine learning\nThis repository represents the implementation part of my master thesis \"Predicting Shapley \nvalues in routing problems with machine learning\".\n\n## Abstract of the master thesis\nIn routing problems, companies and logistics service providers are not only interested \nin identifying the optimal route with the lowest cost, but also in a fair cost allocation \namong the served customers. A highly regarded method for distributing costs is the \nShapley value with its unique fairness properties. As the highly intensive computation \nof the exact Shapley values limits the method’s applicability to small instances in routing \nproblems, this study presents a novel technique for approximating Shapley values using \nmachine learning. The approach is based on the generation of problem-specific features \nto capture the underlying structure of the setting. Therefore, a comprehensive numerical \nstudy using synthetic instances for the traveling salesman problem and the capacitated \nvehicle routing problem is conducted, including a detailed description of the data \ngeneration process as well as the implementation of the machine learning algorithms. A \ndiverse set of models is considered for the experiments in order to determine the most \nsuitable ones for each context. The analyses show excellent results by outperforming \nstraightforward proxies and state-of-the-art approximation methods from the literature \nfor both problem settings, leading to accurate Shapley value predictions for all customers \nwithin seconds. Additionally, the paper provides economic findings on the primary cost \nfactors based on a feature analysis, as well as a study on the computational efficiency \nof the applied models. Importantly, the generalizability of the methodology to further \noperations research contexts is evaluated by applying the technique to a variant of the \nbin packing problem (BPP). The promising results for the BPP show that the approach \ncan be effectively applied to other contexts.\n \n**Keywords**: Shapley value · Cost allocation · Traveling salesman problem · Capacitated \nvehicle routing problem · Machine learning\n\n## Instructions on how to run the program\nIn the `main.ipynb` script, you can define one of the routing problems `\"TSP\"` or `\"CVRP\"` \nas the `optimization_problem` variable. After choosing a routing problem, run the script. \nIt will execute the following notebooks and scripts in this order:\n\n`b1_feature_selection.ipynb`, `a1_linear.ipynb`, `a2_tree.ipynb` (only for TSP), \n`a3_ensembles.ipynb`, `a4_SVM.ipynb`, `a5_NN.ipynb`, `a6_all_models.ipynb`, \n`03_tuning_results/a_tuning_summary.py`, and `03_tuning_results/a_tuning_time.ipynb` \n(only for TSP).\n\nThis procedure will automatically **train**, **tune** and **evaluate** all applied \nmachine learning models on the dataset of the defined routing problem. Furthermore, this \ngenerates all relevant **results** and **output files**. Alternatively, you can run each \nmodel individually for both routing problems in the respective notebook of the model.\n\nIn the notebooks `a1_linear.ipynb`, `a2_tree.ipynb`, `a3_ensembles.ipynb`, `a4_SVM.ipynb`, \nand `a5_NN.ipynb` all applied machine learning models are **implemented** and **tuned**. \nThe **best parameter configurations** are stored as a PDF file in the \n`\"03_tuning_results\"` folder.\n\nThe notebook `a6_all_models.ipynb` trains the best configuration of each model on the \ntraining set and evaluates its performance on the test set. The resulting **test scores** \nare stored as an Excel file in the `\"04_test_results\"` folder.\n\nAll the applied user-defined functions of the notebooks are stored in the \n**ML_functions.py** script.\n\n\u003e ⚠️ Note: Due to storage limitations, the datasets are not included in the repository.\u003cbr\u003e\n\u003e However, the code to generate them can be found in the `\"01_data_generation\"` folder.\n\n## Applied machine learning algorithms for the TSP\n| Algorithm                                     | Implemented in           |\n|-----------------------------------------------|--------------------------|\n| K-Nearest Neighbor (KNN)                      | `a1_linear.ipynb`        |\n| Linear Regression                             | `a1_linear.ipynb`        |\n| Ridge Regression                              | `a1_linear.ipynb`        |\n| Polynomial Regression                         | `a1_linear.ipynb`        |\n| Decision Tree                                 | `a2_tree.ipynb`          |\n| Random Forest                                 | `a3_ensembles.ipynb`     |\n| GradientBoostingRegressionTrees (GBRT)        | `a3_ensembles.ipynb`     |\n| XGBoost                                       | `a3_ensembles.ipynb`     |\n| Linear Support Vector Machine (Linear SVM)    | `a4_SVM.ipynb`           |\n| Kernel Machine                                | `a4_SVM.ipynb`           |\n| Multilayer Perceptron Neural Network(NN/MLP)  | `a5_NN.ipynb`            |\n\n## Applied machine learning algorithms for the CVRP\n| Algorithm                                     | Implemented in           |\n|-----------------------------------------------|--------------------------|\n| K-Nearest Neighbor (KNN)                      | `a1_linear.ipynb`        |\n| Polynomial Regression                         | `a1_linear.ipynb`        |\n| Random Forest                                 | `a3_ensembles.ipynb`     |\n| XGBoost                                       | `a3_ensembles.ipynb`     |\n| Kernel Machine                                | `a4_SVM.ipynb`           |\n| Multilayer Perceptron Neural Network(NN/MLP)  | `a5_NN.ipynb`            |\n\n## Applied benchmarks\n- SHapley APproximation based on a fixed Order (SHAPO)\n- Depot distance\n\n## Author\n- [Dennis Götz](https://github.com/dennismgoetz)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdennismgoetz%2Fma_predicting_shapley_values","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdennismgoetz%2Fma_predicting_shapley_values","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdennismgoetz%2Fma_predicting_shapley_values/lists"}