{"id":15900076,"url":"https://github.com/fcakyon/ieee-fraud-detection","last_synced_at":"2025-06-17T23:06:31.793Z","repository":{"id":110159129,"uuid":"327891585","full_name":"fcakyon/ieee-fraud-detection","owner":"fcakyon","description":"IEEE Fraud Detection with XGBoost and CatBoost","archived":false,"fork":false,"pushed_at":"2021-01-10T10:42:11.000Z","size":274,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-02T17:01:34.861Z","etag":null,"topics":["bayesian-search","catboost","fraud-detection","fraud-detection-kaggle","hypterparameter-optimization","notebook","pandas","random-search","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fcakyon.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":"2021-01-08T12:04:49.000Z","updated_at":"2024-09-09T16:23:05.000Z","dependencies_parsed_at":null,"dependency_job_id":"bc1cfe61-171b-4bbb-91f6-895e8ada4fa2","html_url":"https://github.com/fcakyon/ieee-fraud-detection","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/fcakyon/ieee-fraud-detection","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fcakyon%2Fieee-fraud-detection","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fcakyon%2Fieee-fraud-detection/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fcakyon%2Fieee-fraud-detection/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fcakyon%2Fieee-fraud-detection/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fcakyon","download_url":"https://codeload.github.com/fcakyon/ieee-fraud-detection/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fcakyon%2Fieee-fraud-detection/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260453741,"owners_count":23011575,"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":["bayesian-search","catboost","fraud-detection","fraud-detection-kaggle","hypterparameter-optimization","notebook","pandas","random-search","xgboost"],"created_at":"2024-10-06T10:41:48.031Z","updated_at":"2025-06-17T23:06:26.775Z","avatar_url":"https://github.com/fcakyon.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# IEEE Fraud Detection with Anomaly Detection Algorithms\n[IEEE Fraud Detection](https://www.kaggle.com/c/ieee-fraud-detection) is a competition that you are predicting the probability that an online transaction is fraudulent, as denoted by the binary target isFraud. The data is broken into two files identity and transaction, which are joined by TransactionID. Not all transactions have corresponding identity information.\n\nThis repo provides training hyperparameter optimization and evaluation scripts for [IEEE Fraud Detection data](https://www.kaggle.com/c/ieee-fraud-detection/data) with [XGBoost](https://github.com/dmlc/xgboost) and [CatBoost](https://github.com/catboost/catboost) algorithms.\n\nInspect [CatBoost notebook](\u003chttps://github.com/fcakyon/ieee-fraud-detection/tree/main/notebook/fraud-detection-catboost.ipynb\u003e) and [XGBoost notebook](\u003chttps://github.com/fcakyon/ieee-fraud-detection/tree/main/notebook/fraud-detection-xgboost.ipynb\u003e) for detailed demo.\n\n## Usage\n- Clone:\n```bash\ngit clone https://github.com/fcakyon/ieee-fraud-detection.git\n```\n\n- Prepare conda environment:\n```bash\nconda env create -f environment.yml\n```\n\n```bash\nconda activate frauddetection\n```\n\n- Fir XGBoost or CatBoost model:\n```bash\npython train_xgboost.py\n```\n```bash\npython train_catboost.py\n```\n\n## Detailed Usage\n- After downloading the data to ./data folder, you can get the preprocessed data via get_data() method in preprocessing.py module:\n```python\nfrom preprocessing import get_data\n\nfloat: val_split = 0.2 # splits %80 of data for train and %20 for val\nbool: apply_label_encoding = True # applies label encoding to categorical features\nbool: fillna = True # fills missing values with -999\n\ndata = get_data(val_split, apply_label_encoding, fillna)\n```\n\n- After initializing CatBoost or XGBoost classifier, perform automatic hyperparameter optimization via perform_random_search() or perform_bayes_search() in hyperparam_optimizing.py module:\n```python\nfrom hyperparam_optimizing import perform_bayes_search, CATBOOST_BAYESSEARCH_PARAMS\nimport catboost as cb\n\n# define xgboost or catboost instance\nestimator = cb.CatBoostClassifier(\n    n_estimators=200,\n    learning_rate=0.05,\n    metric_period=500,\n    od_wait=500,\n    task_type=\"CPU\",\n    depth=8,\n) \n\n# parse get_data() output\nX_train = data[\"X_train\"]\nX_val = data[\"X_val\"]\ny_train = data[\"y_train\"]\ny_val = data[\"y_val\"]\n\n# define parameter grid\nparam_grid = CATBOOST_BAYESSEARCH_PARAMS\n\n# define scoring metric, full list can be seen at https://scikit-learn.org/stable/modules/model_evaluation.html\nscoring = 'roc_auc'\n\n# perform bayes parameter search for catboost classifier\nbest_estimator = perform_bayes_search(\n    estimator, X_train, X_val, y_train, y_val, param_grid, scoring\n)\n```\n\n- After fitting a model, print results such as accuracy, auc score, confusion matrix, f1 scores using calculate_scores() method from scoring.py module:\n```python\nfrom scoring import calculate_scores\n\nscores = calculate_scores(estimator=best_estimator, X_val=X_val, y_val=y_val)\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffcakyon%2Fieee-fraud-detection","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffcakyon%2Fieee-fraud-detection","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffcakyon%2Fieee-fraud-detection/lists"}