{"id":26157996,"url":"https://github.com/corels/pycorels","last_synced_at":"2025-04-14T09:41:15.314Z","repository":{"id":44244980,"uuid":"137264284","full_name":"corels/pycorels","owner":"corels","description":"Public home of pycorels, the python binding to CORELS","archived":false,"fork":false,"pushed_at":"2020-06-25T00:50:24.000Z","size":17945,"stargazers_count":78,"open_issues_count":20,"forks_count":14,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-13T23:27:07.166Z","etag":null,"topics":["c-plus-plus","machine-learning-algorithms","python"],"latest_commit_sha":null,"homepage":null,"language":"Python","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/corels.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":"2018-06-13T19:59:47.000Z","updated_at":"2025-04-01T17:14:19.000Z","dependencies_parsed_at":"2022-09-05T02:11:17.055Z","dependency_job_id":null,"html_url":"https://github.com/corels/pycorels","commit_stats":null,"previous_names":["fingoldin/pycorels"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/corels%2Fpycorels","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/corels%2Fpycorels/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/corels%2Fpycorels/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/corels%2Fpycorels/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/corels","download_url":"https://codeload.github.com/corels/pycorels/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248855744,"owners_count":21172637,"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":["c-plus-plus","machine-learning-algorithms","python"],"created_at":"2025-03-11T10:30:42.955Z","updated_at":"2025-04-14T09:41:15.284Z","avatar_url":"https://github.com/corels.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pycorels\n[![Build Status](https://travis-ci.org/fingoldin/pycorels.svg?branch=master)](https://travis-ci.org/fingoldin/pycorels)\n[![Documentation Status](https://readthedocs.org/projects/pycorels/badge/?version=latest)](https://pycorels.readthedocs.io/en/latest/?badge=latest)\n\nWelcome to the python binding of the Certifiably Optimal RulE ListS (CORELS) algorithm!\n\n## Overview\n\nCORELS (Certifiably Optimal RulE ListS) is a custom discrete optimization technique for building rule lists over a categorical feature space. Using algorithmic bounds and efficient data structures, our approach produces optimal rule lists on practical problems in seconds.\n\nThe CORELS pipeline is simple. Given a dataset matrix of size `n_samples x n_features` and a labels vector of size `n_samples`, it will compute a rulelist (similar to a series of if-then statements) to predict the labels with the highest accuracy.\n\nHere's an example:\n![Whoops! The image failed to load](https://raw.githubusercontent.com/fingoldin/pycorels/master/utils/Corels.png)\n\nMore information about the algorithm [can be found here](https://corels.eecs.harvard.edu/corels)\n\n## Dependencies\n\nCORELS uses [Python](https://www.python.org), [Numpy](https://www.numpy.org), [GMP](https://gmplib.org).\nGMP (GNU Multiple Precision library) is not required, but it is *highly recommended*, as it improves performance. If it is not installed, CORELS will run slower.\n\n## Installation\n\nCORELS exists on PyPI, and can be downloaded with\n`pip install corels`\n\nTo install from this repo, simply run `pip install .` or `python setup.py install` from the `corels/` directory.\n\nHere are some detailed examples of how to install all the dependencies needed, followed by corels itself:\n\n#### Ubuntu\n\n```\nsudo apt install libgmp-dev\npip install corels\n```\n\n#### Mac\n\n```\n# Install g++ and gmp\n/usr/bin/ruby -e \"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)\"\nbrew install g++ gmp\n\npip install corels\n```\n\n#### Windows\nNote: Python 2 is currently NOT supported on Windows.\n```\npip install corels\n```\n\n#### Troubleshooting\n- If you come across an error saying Python version \u003e=3.5 is required, try running `pip install numpy` before again running `pip install corels`. \n- If `pip` does not successfully install corels, try using `pip3`\n\n## Documentation\n\nThe docs for this package are hosted on here: https://pycorels.readthedocs.io/\n\n## Tests\n\nAfter installing corels, run `pytest` (you may have to install it with `pip install pytest` first) from the `tests/` folder, where the tests are located.\n\n## Examples\n\n### Large dataset, loaded from [this file](https://raw.githubusercontent.com/fingoldin/pycorels/master/examples/data/compas.csv)\n\n```python\nfrom corels import *\n\n# Load the dataset\nX, y, _, _ = load_from_csv(\"data/compas.csv\")\n\n# Create the model, with 10000 as the maximum number of iterations \nc = CorelsClassifier(n_iter=10000)\n\n# Fit, and score the model on the training set\na = c.fit(X, y).score(X, y)\n\n# Print the model's accuracy on the training set\nprint(a)\n```\n\n### Toy dataset (See picture example above)\n\n```python\nfrom corels import CorelsClassifier\n\n# [\"loud\", \"samples\"] is the most verbose setting possible\nC = CorelsClassifier(max_card=2, c=0.0, verbosity=[\"loud\", \"samples\"])\n\n# 4 samples, 3 features\nX = [[1, 0, 1], [0, 0, 0], [1, 1, 0], [0, 1, 0]]\ny = [1, 0, 0, 1]\n# Feature names\nfeatures = [\"Mac User\", \"Likes Pie\", \"Age \u003c 20\"]\n\n# Fit the model\nC.fit(X, y, features=features, prediction_name=\"Has a dirty computer\")\n\n# Print the resulting rulelist\nprint(C.rl())\n\n# Predict on the training set\nprint(C.predict(X))\n```\n\nMore examples are in the `examples/` directory\n\n\n### Questions?\nEmail the maintainer at: vassilioskaxiras@gmail.com\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcorels%2Fpycorels","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcorels%2Fpycorels","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcorels%2Fpycorels/lists"}