{"id":16518979,"url":"https://github.com/zoj613/pyloras","last_synced_at":"2026-03-03T17:33:35.745Z","repository":{"id":46826307,"uuid":"334739886","full_name":"zoj613/pyloras","owner":"zoj613","description":"Experimental implementations of several (over/under)-sampling techniques not yet available in the imbalanced-learn library.","archived":false,"fork":false,"pushed_at":"2023-05-08T04:48:35.000Z","size":5235,"stargazers_count":12,"open_issues_count":4,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-03T19:13:16.026Z","etag":null,"topics":["imbalanced-learn","loras","prowras"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zoj613.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}},"created_at":"2021-01-31T19:34:00.000Z","updated_at":"2024-07-18T19:17:51.000Z","dependencies_parsed_at":"2022-09-24T17:56:47.287Z","dependency_job_id":"0a52cf6c-a806-49e9-af0b-d6be522e491f","html_url":"https://github.com/zoj613/pyloras","commit_stats":{"total_commits":35,"total_committers":2,"mean_commits":17.5,"dds":0.02857142857142858,"last_synced_commit":"9f27e7e25eb62dd90ca9883e3ee60f9c2ce348dd"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/zoj613/pyloras","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zoj613%2Fpyloras","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zoj613%2Fpyloras/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zoj613%2Fpyloras/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zoj613%2Fpyloras/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zoj613","download_url":"https://codeload.github.com/zoj613/pyloras/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zoj613%2Fpyloras/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30052498,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-03T15:26:47.567Z","status":"ssl_error","status_checked_at":"2026-03-03T15:26:17.132Z","response_time":61,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":["imbalanced-learn","loras","prowras"],"created_at":"2024-10-11T16:44:32.691Z","updated_at":"2026-03-03T17:33:35.715Z","avatar_url":"https://github.com/zoj613.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LoRAS\n\n[![CI][3]](https://github.com/zoj613/pyloras/actions/workflows/build-and-test.yml)\n[![Codecov][4]](https://codecov.io/gh/zoj613/pyloras/)\n[![PyPI][5]](https://pypi.org/project/pyloras/#history)\n\nLocalized Random Affine Shadowsampling\n\nThis repo provides a python implementation of an imbalanced dataset oversampling\ntechnique known as Localized Random Affine Shadowsampling (LoRAS). It also provides\nimplementations of several other over/under-sampling algorithms not yet available in\nthe ``imbalanced-learn`` package. These implementations piggybacks off of ``imbalanced-learn``\nand thus aim to be as compatible as possible with it.\n\n\n## Dependencies\n- `Python \u003e= 3.8`\n- `numpy \u003e= 1.17.3`\n- `imbalanced-learn \u003c 1.0.0`\n\n\n## Installation\n\nUsing `pip`:\n```shell\n$ pip install -U pyloras\n```\n\nAlternatively, one can install from source with the following shell commands:\n```shell\n$ git clone https://github.com/zoj613/pyloras.git\n$ cd pyloras/\n$ pip install .\n```\n\n## Usage\n\n```python\nfrom collections import Counter\nfrom pyloras import LORAS\nfrom sklearn.datasets import make_classification\n\nX, y = make_classification(n_samples=20000, n_features=5, n_informative=5,\n                           n_redundant=0, n_repeated=0, n_classes=3,\n                           n_clusters_per_class=1,\n                           weights=[0.01, 0.05, 0.94],\n                           class_sep=0.8, random_state=0)\n\nlrs = LORAS(random_state=0, manifold_learner_params={'perplexity': 35, 'n_iter': 250})\nprint(sorted(Counter(y).items()))\n# [(0, 270), (1, 1056), (2, 18674)]\nX_resampled, y_resampled = lrs.fit_resample(X, y)\nprint(sorted(Counter(y_resampled.astype(int)).items()))\n# [(0, 18674), (1, 18674), (2, 18674)]\n\n# one can also use any custom 2d manifold learner via the ``manifold_learner` parameter\nfrom umap import UMAP\nLORAS(manifold_learner=UMAP()).fit_resample(X, y)\n\n```\n\n## Visualization\n\nBelow is a comparision of `imbalanced-learn`'s `SMOTE` implementation with `LORAS`\non the dummy data used in [this doc page][2] using the default parameters.\n\n![](./scripts/img/resampled_data.svg)\n![](./scripts/img/decision_fn.svg)\n![](./scripts/img/particularities.svg)\n\nThe plots can be reproduced by running:\n```\n$ python scripts/compare_oversamplers.py --n_neighbors=\u003coptional\u003e --n_shadow=\u003coptional\u003e --n_affine=\u003coptional\u003e\n```\n\n## References\n- Bej, S., Davtyan, N., Wolfien, M. et al. LoRAS: an oversampling approach for imbalanced datasets. Mach Learn 110, 279–301 (2021). https://doi.org/10.1007/s10994-020-05913-4\n- Bej, S., Schultz, K., Srivastava, P., Wolfien, M., \u0026 Wolkenhauer, O. (2021). A multi-schematic classifier-independent oversampling approach for imbalanced datasets. ArXiv, abs/2107.07349.\n- A. Tripathi, R. Chakraborty and S. K. Kopparapu, \"A Novel Adaptive Minority Oversampling Technique for Improved Classification in Data Imbalanced Scenarios,\" 2020 25th International Conference on Pattern Recognition (ICPR), 2021, pp. 10650-10657, doi: 10.1109/ICPR48806.2021.9413002.\n\n\n[1]: https://python-poetry.org/docs/pyproject/\n[2]: https://imbalanced-learn.org/stable/auto_examples/over-sampling/plot_comparison_over_sampling.html#more-advanced-over-sampling-using-adasyn-and-smote\n[3]: https://img.shields.io/github/workflow/status/zoj613/pyloras/CI/main?style=flat-square\n[4]: https://img.shields.io/codecov/c/github/zoj613/pyloras?style=flat-square\n[5]: https://img.shields.io/github/v/release/zoj613/pyloras?include_prereleases\u0026style=flat-square\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzoj613%2Fpyloras","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzoj613%2Fpyloras","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzoj613%2Fpyloras/lists"}