{"id":28122580,"url":"https://github.com/artefactory/mgs-grf","last_synced_at":"2025-05-14T08:14:06.930Z","repository":{"id":286809136,"uuid":"826345833","full_name":"artefactory/mgs-grf","owner":"artefactory","description":null,"archived":false,"fork":false,"pushed_at":"2025-05-13T12:53:10.000Z","size":3502,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-05-13T13:43:48.038Z","etag":null,"topics":["research-center"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/artefactory.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2024-07-09T14:27:57.000Z","updated_at":"2025-04-14T16:03:00.000Z","dependencies_parsed_at":"2025-04-08T13:58:42.575Z","dependency_job_id":null,"html_url":"https://github.com/artefactory/mgs-grf","commit_stats":null,"previous_names":["artefactory/mgs-grf"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artefactory%2Fmgs-grf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artefactory%2Fmgs-grf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artefactory%2Fmgs-grf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artefactory%2Fmgs-grf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/artefactory","download_url":"https://codeload.github.com/artefactory/mgs-grf/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254101545,"owners_count":22014909,"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","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":["research-center"],"created_at":"2025-05-14T08:14:03.695Z","updated_at":"2025-05-14T08:14:06.923Z","avatar_url":"https://github.com/artefactory.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n# Harnessing Mixed Features for Imbalance Data Oversampling: Application to Bank Customers Scoring\n\n\nAbdoulaye SAKHO\u003csup\u003e1, 2\u003c/sup\u003e, Emmanuel MALHERBE\u003csup\u003e1\u003c/sup\u003e, Carl-Erik GAUTHIER\u003csup\u003e3\u003c/sup\u003e, Erwan SCORNET\u003csup\u003e2\u003c/sup\u003e \u003cbr\u003e\n \u003csup\u003e1\u003c/sup\u003e \u003csub\u003e Artefact Research Center, \u003c/sub\u003e \u003cbr\u003e \u003csup\u003e2\u003c/sup\u003e \u003csub\u003e*LPSM* - Sorbonne Université,\u003c/sub\u003e \u003csup\u003e3\u003c/sup\u003e \u003csub\u003eSociété Générale\u003c/sub\u003e\n\nPreprint. \u003cbr\u003e\n[[Full Paper]](https://arxiv.org/pdf/2503.22730) \u003cbr\u003e\n\n\u003c/div\u003e\n\n\u003cp align=\"center\"\u003e\u003cimg width=\"65%\" src=\"data/logos/image.png\"  /\u003e\u003c/p\u003e\n\n**Abstract:** *This study investigates rare event detection on tabular data within binary classification. Many real-world classification tasks, such as in banking sector, deal with mixed features, which have a significant impact on predictive performances. To this purpose, we introduce MGS-GRF, an oversampling strategy designed for mixed features. This method uses a kernel density estimator with locally estimated full-rank covariances to generate continuous features, while categorical ones are drawn from the original samples through a generalized random forest.*\n\nYou will find code to reproduce the paper experiments as well as an nice implementation of our *new* and *efficient* strategy for your projects.\n## ⭐ Table of Contents\n  - [How to use MGS-GRF](#-how-to-use-the-mgs-grf-algorithm-to-learn-on-imbalanced-data)\n  - [Reproducing the paper experiments](#-reproducing-the-paper-experiments)\n  - [Data sets](#-data-sets)\n  - [Acknowledgements](#-acknowledgements)\n  - [Citation](#-citation)\n\n## ⭐ How to use the MGS-GRF Algorithm to learn on imbalanced data\nHere is a short example on how to use MGS-GRF: \n```python\nfrom mgs_grf import MGSGRFOverSampler\n\n## Apply MGS-GRF procedure to oversample the data\nmgs_grf = MGSGRFOverSampler(K=len(numeric_features),categorical_features=categorical_features,random_state=0)\nbalanced_X, balanced_y = mgs_grf.fit_resample(X_train,y_train)\nprint(\"Augmented data : \", Counter(balanced_y))\n\n## Encode the categorical variables\nenc = OneHotEncoder(handle_unknown='ignore',sparse_output=False)\nbalanced_X_encoded = enc.fit_transform(balanced_X[:,categorical_features])\nbalanced_X_final = np.hstack((balanced_X[:,numeric_features],balanced_X_encoded))\n\n# Fit the final classifier on the augmented data\nclf_mgs = lgb.LGBMClassifier(n_estimators=100,verbosity=-1, random_state=0)\nclf_mgs.fit(balanced_X_final, balanced_y)\n\n```\nA more detailed notebook example is available [here](example/example.ipynb).\n\n\n## ⭐ Reproducing the paper experiments\n\nIf you want to reproduce our paper experiments:\n  - Section 4.2 : the [Python file](protocols/run_synthetic_coherence.py) reproduce the experiments (data sets, oversampling and traing). Then the results can be analyzed with this [notebook](protocols/notebooks/res_coh.ipynb).\n  - Section 4.3 : the   [Python file](protocols/run_synthetic_association.py) reproduce the experiments (data sets, oversampling and traing). Then the results can be analyzed with this [notebook](protocols/notebooks/res_asso.ipynb).\n  - Section 5 : the [Python file](protocols/run_protocol-final.py) reproduce the experiments (data sets, oversampling and traing). Then the results can be analyzed with this [notebook](protocols/notebooks/res_real_data.ipynb).\n\n## ⭐ Data sets\n\nThe data sets of used for our article should be dowloaded  inside the *data/externals* folder. The data sets are available at the followings adresses :\n\n* [BankMarketing](https://archive.ics.uci.edu/dataset/222/bank+marketing)\n* [BankChurners](https://www.kaggle.com/datasets/thedevastator/predicting-credit-card-customer-attrition-with-m)\n\n\n## ⭐ Acknowledgements\n\nThis work was done through a partenership between **Artefact Research Center** and the **Laboratoire de Probabilités Statistiques et Modélisation** (LPSM) of Sorbonne University.\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://www.artefact.com/data-consulting-transformation/artefact-research-center/\"\u003e\n    \u003cimg src=\"https://raw.githubusercontent.com/artefactory/choice-learn/main/docs/illustrations/logos/logo_arc.png\" height=\"80\" /\u003e\n  \u003c/a\u003e\n  \u0026emsp;\n  \u0026emsp;\n  \u003ca href=\"https://www.lpsm.paris/\"\u003e\n    \u003cimg src=\"data/logos//logo_LPSM.jpg\" height=\"95\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\n## ⭐ Citation\n\nIf you find the code usefull, please consider citing us :\n```\n@article{sakho2025harnessing,\n  title={Harnessing Mixed Features for Imbalance Data Oversampling: Application to Bank Customers Scoring},\n  author={Sakho, Abdoulaye and Malherbe, Emmanuel and Gauthier, Carl-Erik and Scornet, Erwan},\n  journal={arXiv preprint arXiv:2503.22730},\n  year={2025}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fartefactory%2Fmgs-grf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fartefactory%2Fmgs-grf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fartefactory%2Fmgs-grf/lists"}