{"id":29428705,"url":"https://github.com/urbslab/scikit-elcs","last_synced_at":"2025-07-12T15:19:29.435Z","repository":{"id":37661748,"uuid":"206376826","full_name":"UrbsLab/scikit-eLCS","owner":"UrbsLab","description":"A scikit-learn-compatible Python implementation of eLCS, a supervised learning variant of Learning Classifier Systems","archived":false,"fork":false,"pushed_at":"2024-06-17T22:54:50.000Z","size":21070,"stargazers_count":19,"open_issues_count":3,"forks_count":9,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-06-25T01:14:06.576Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/UrbsLab.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}},"created_at":"2019-09-04T17:39:46.000Z","updated_at":"2024-08-04T16:31:53.000Z","dependencies_parsed_at":"2022-09-17T14:30:35.030Z","dependency_job_id":null,"html_url":"https://github.com/UrbsLab/scikit-eLCS","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/UrbsLab/scikit-eLCS","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UrbsLab%2Fscikit-eLCS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UrbsLab%2Fscikit-eLCS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UrbsLab%2Fscikit-eLCS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UrbsLab%2Fscikit-eLCS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/UrbsLab","download_url":"https://codeload.github.com/UrbsLab/scikit-eLCS/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UrbsLab%2Fscikit-eLCS/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265009542,"owners_count":23697194,"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":[],"created_at":"2025-07-12T15:19:18.474Z","updated_at":"2025-07-12T15:19:29.426Z","avatar_url":"https://github.com/UrbsLab.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"Master Status: [![Build Status](https://travis-ci.com/UrbsLab/scikit-eLCS.svg?branch=master)](https://travis-ci.com/UrbsLab/scikit-eLCS)\n\n# scikit-eLCS\n\nThe scikit-eLCS package includes a sklearn-compatible Python implementation of eLCS, a supervised learning variant of the Learning Classifier System, based off of UCS. In general, Learning Classifier Systems (LCSs) are a classification of Rule Based Machine Learning Algorithms that have been shown to perform well on problems involving high amounts of heterogeneity and epistasis. Well designed LCSs are also highly human interpretable. LCS variants have been shown to adeptly handle supervised and reinforced, classification and regression, online and offline learning problems, as well as missing or unbalanced data. These characteristics of versatility and interpretability give LCSs a wide range of potential applications, notably those in biomedicine. This package is **still under active development** and we encourage you to check back on this repository for updates.\n\neLCS, or Educational Learning Classifier System, implements the core components of a Michigan-Style Learning Classifier System (where the system's genetic algorithm operates on a rule level, evolving a population of rules with each their own parameters) in an easy to understand way, while still being highly functional in solving ML problems.\n\nWhile Learning Classifier Systems are commonly applied to genetic analyses, where epistatis (i.e. feature interactions) is common, the eLCS algorithm implemented in this package can be applied to almost any supervised classification data set and supports:\n\n* Feature sets that are discrete/categorical, continuous-valued or a mix of both\n* Data with missing values\n* Binary endpoints (i.e., classification)\n* Multi-class endpoints (i.e., classification)\n* eLCS does not currently support regression problems. We have built out the infrastructure for it do so, but have disabled its functionality for this version.\n\nBuilt into this code, is a strategy to 'automatically' detect from the loaded data, these relevant above characteristics so that they don't need to be parameterized at initialization.\n\nThe core Scikit package only supports numeric data. However, an additional StringEnumerator Class is provided within the DataCleanup file that allows quick data conversion from any type of data into pure numeric data, making it possible for natively string/non-numeric data to be run by eLCS.\n\nIn addition, powerful data tracking collection methods are built into the scikit package, that continuously tracks features every iteration such as:\n\n* Approximate Accuracy\n* Average Population Generality\n* Macropopulation Size\n* Micropopulation Size\n* Match Set, Correct Set Sizes\n* Number of classifiers subsumed/deleted/covered\n* Number of crossover/mutation operations performed\n* Times for matching, deletion, subsumption, selection, evaluation\n\nThese values can then be exported as a csv after training is complete for analysis using the built in \"export_iteration_tracking_data\" method.\n\nIn addition, the package includes functionality that allows the final rule population to be exported as a csv after training.\n\n## Usage\nFor more information on the eLCS algorithm and how to use it, please refer to the [\"eLCS User Guide\"](https://github.com/UrbsLab/scikit-eLCS/blob/master/eLCS%20User%20Guide.ipynb) Jupyter Notebook inside this repository.\n\n## Usage TLDR\n```python\n#Import Necessary Packages/Modules\nfrom skeLCS import eLCS\nimport numpy as np\nimport pandas as pd\nfrom sklearn.model_selection import cross_val_score\n\n#Load Data Using Pandas\ndata = pd.read_csv('myDataFile.csv') #REPLACE with your own dataset .csv filename\ndataFeatures = data.drop(classLabel,axis=1).values #DEFINE classLabel variable as the Str at the top of your dataset's class column\ndataPhenotypes = data[classLabel].values\n\n#Shuffle Data Before CV\nformatted = np.insert(dataFeatures,dataFeatures.shape[1],dataPhenotypes,1)\nnp.random.shuffle(formatted)\ndataFeatures = np.delete(formatted,-1,axis=1)\ndataPhenotypes = formatted[:,-1]\n\n#Initialize eLCS Model\nmodel = eLCS(learning_iterations = 5000)\n\n#3-fold CV\nprint(np.mean(cross_val_score(model,dataFeatures,dataPhenotypes,cv=3)))\n```\n\n## License\nPlease see the repository [license](https://github.com/UrbsLab/scikit-eLCS/blob/master/LICENSE) for the licensing and usage information for scikit-eLCS.\n\nGenerally, we have licensed scikit-eLCS to make it as widely usable as possible.\n\n## Installation\nscikit-eLCS is built on top of the following Python packages:\n\u003col\u003e\n  \u003cli\u003e numpy \u003c/li\u003e\n  \u003cli\u003e pandas \u003c/li\u003e\n  \u003cli\u003e scikit-learn \u003c/li\u003e\n\u003c/ol\u003e\n\nOnce the prerequisites are installed, you can install scikit-eLCS with a pip command:\n```\npip/pip3 install scikit-elcs\n```\nWe strongly recommend you use Python 3. scikit-eLCS does not support Python 2, given its depreciation in Jan 1 2020. If something goes wrong during installation, make sure that your pip is up to date and try again.\n```\npip/pip3 install --upgrade pip\n```\n\n## Contributing to scikit-eLCS\nscikit-eLCS is an open source project and we'd love if you could suggest changes!\n\n\u003col\u003e\n  \u003cli\u003e Fork the project repository to your personal account and clone this copy to your local disk\u003c/li\u003e\n  \u003cli\u003e Create a branch from master to hold your changes: (e.g. \u003cb\u003egit checkout -b my-contribution-branch\u003c/b\u003e) \u003c/li\u003e\n  \u003cli\u003e Commit changes on your branch. Remember to never work on any other branch but your own! \u003c/li\u003e\n  \u003cli\u003e When you are done, push your changes to your forked GitHub repository with \u003cb\u003egit push -u origin my-contribution-branch\u003c/b\u003e \u003c/li\u003e\n  \u003cli\u003e Create a pull request to send your changes to the scikit-eLCS maintainers for review. \u003c/li\u003e\n\u003c/ol\u003e\n\n**Before submitting your pull request**\n\nIf your contribution changes eLCS in any way, make sure you update the Jupyter Notebook documentation and the README with relevant details. If your contribution involves any code changes, update the project unit tests to test your code changes, and make sure your code is properly commented to explain your rationale behind non-obvious coding practices.\n\n**After submitting your pull request**\n\nAfter submitting your pull request, Travis CI will run all of the project's unit tests. Check back shortly after submitting to make sure your code passes these checks. If any checks come back failed, do your best to address the errors.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Furbslab%2Fscikit-elcs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Furbslab%2Fscikit-elcs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Furbslab%2Fscikit-elcs/lists"}