Skip to main content

MDL Rule Lists for prediction and subgroup discovery.

PyPI version PyPI - Python Version License: MIT

This repository contains the code for using rule lists for univariate or multivariate classification or regression and its equivalents in Data Mining and Subgroup Discovery. These models use the Minimum Description Length (MDL) principle as optimality criteria.

Dependencies

This project was written for Python 3.7. All required packages from PyPI are specified in the requirements.txt.

NOTE: This list of packages includes the gmpy2 package.

Installation

The latest release can be installed using pip:

pip install rulelist

If you run into issues regarding the gmpy2 package mentioned above, please refer to their documentation for help.

For the current version, you can clone the repository and install the dependencies locally:

git clone https://github.com/HMProenca/RuleList.git
cd RuleList
pip install -r requirements.txt

Example of usage for prediction:

import pandas as pd
from rulelist import RuleList
from sklearn import datasets
from sklearn.model_selection import train_test_split

task = 'prediction'
target_model = 'categorical'

data = datasets.load_breast_cancer()
Y = pd.Series(data.target)
X = pd.DataFrame(data.data)

X_train, X_test, y_train, y_test = train_test_split(X, Y, test_size = 0.3)

model = RuleList(task = task, target_model = target_model)

model.fit(X_train, y_train)

y_pred = model.predict(X_test)
from sklearn.metrics import accuracy_score
accuracy_score(y_test.values,y_pred)

print(model)

Example of usage for subgroup discovery:

import pandas as pd
from rulelist.rulelist import RuleList
from sklearn import datasets

task = 'discovery'
target_model = 'gaussian'

data = datasets.load_boston()
y = pd.Series(data.target)
X = pd.DataFrame(data.data)

model = RuleList(task = task, target_model = target_model)

model.fit(X, y)

print(model)

Contact

If there are any questions or issues, please contact me by mail at hugo.manuel.proenca@gmail.com or open an issue here on Github.

Citation

In a machine learning (prediction) context for problems of classification, regression, multi-label classification, multi-category classification, or multivariate regression cite the corresponding bibtex of the first classification application of MDL rule lists:

@article{proencca2020interpretable,
  title={Interpretable multiclass classification by MDL-based rule lists},
  author={Proen{\c{c}}a, Hugo M and van Leeuwen, Matthijs},
  journal={Information Sciences},
  volume={512},
  pages={1372--1393},
  year={2020},
  publisher={Elsevier}
}

in the context of data mining and subgroup discovery please refer to subgroup lists:

@article{proencca2020discovering,
  title={Discovering outstanding subgroup lists for numeric targets using MDL},
  author={Proen{\c{c}}a, Hugo M and Gr{\"u}nwald, Peter and B{\"a}ck, Thomas and van Leeuwen, Matthijs},
  journal={arXiv preprint arXiv:2006.09186},
  year={2020}
} 

and

@article{proencca2021robust,
  title={Robust subgroup discovery},
  author={Proen{\c{c}}a, Hugo Manuel and B{\"a}ck, Thomas and van Leeuwen, Matthijs},
  journal={arXiv preprint arXiv:2103.13686},
  year={2021}
}

References

Metadata

Release files for rulelist 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rulelist 0.2.0
File Size Uploaded Provenance
rulelist-0.2.0.tar.gz 38.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for rulelist 0.2.0
File Interpreter ABI Platform
rulelist-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 93.6 kB

Release files / rulelist-0.2.0.tar.gz

Download URL rulelist-0.2.0.tar.gz
Size 38.3 kB
Tags Source
SHA-256 checksum
How to use checksums
58dbd8bffde004c012a0dc5162b45f92267a4dc9109ecea2fdb057204069172a
BLAKE2b-256 checksum
How to use checksums
59c8fd020e685dc41032ee35fd9b6cbecbe1fc131c0038c0f3d755661a68b09c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.6.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.8

Release files / rulelist-0.2.0-py3-none-any.whl

Download URL rulelist-0.2.0-py3-none-any.whl
Size 55.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
01333fa8a6400de71374afb0e16ac00701b7c47e56b02283da78cdbf89e6fcef
BLAKE2b-256 checksum
How to use checksums
09362677f239a15cd409f78932a983acc99cbd7496f05e8e7be8c86986dd0835
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.6.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.8

Security for rulelist 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page