Skip to main content

l3wrapper

Latest PyPI version Documentation Status doi badge

A Python 3 wrapper around Live-and-Let-Live (L^3) classifier binaries implementing the scikit-learn estimator interface. The associative classifier was originally published in [1].

When imported, the package looks for L^3 compiled binaries in the user’s $HOME directory. If they are not found, it downloads them. If you mind letting the wrapper do this for you, you can download the binaries for macOS Catalina or Ubuntu 18.04.

Installation

Install using pip with:

pip install l3wrapper

Or, download a wheel or source archive from PyPI.

Requirements

The package is dependent on numpy, scikit-learn, tqdm, and requests.

Usage

By design, the classifier is intended for categorical/discrete attributes. Therefore, using subtypes of numpy.number to fit the model is not allowed.

Simple classification

A sample usage with the Car Evaluation dataset:

>>> from l3wrapper.l3wrapper import L3Classifier
>>> import numpy as np
>>> from sklearn.model_selection import train_test_split
>>> from sklearn.metrics import accuracy_score
>>> X = np.loadtxt('car.data', dtype=object, delimiter=',')
>>> y = X[:, -1]
>>> X = X[:, :-1]
>>> X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.33, random_state=42)
>>> clf = L3Classifier().fit(X_train, y_train)
>>> accuracy_score(y_test, clf.predict(X_test))
0.9071803852889667

Column names and interpretable rules

Use the column_names and save_human_readable parameters to obtain an interpretable representation of the model:

>>> column_names = ['buying', 'maint', 'doors', 'persons', 'lug_boot', 'safety']
>>> clf = L3Classifier().fit(X_train, y_train, column_names=column_names, save_human_readable=True)

The snippet will generate the level1 and level2 rule sets. An excerpt is:

0 persons:4,safety:high,maint:low,buying:high acc 12 100.0 4
1 doors:2,buying:vhigh,safety:med,lug_boot:med unacc 11 100.0 4

in the form:

<rule_id>\t<antecedent>\t<class label>\t<support count>\t<confidence(%)>\t<rule length>

Known limitations

  • fixed The parallel training of multiple models cause failures (e.g. using ``GridSearchCV``, ``joblib`` or custom parallelism through ``multiprocessing`` with ``njobs>1``).

  • The scikit-learn’s utility check_estimator still doesn’t work, as L3Classifier doesn’t support numerical input.

Compatibility

The underlying L^3 binaries are currently available for macOS and Ubuntu.

The package is currently tested with Python 3.6+.

License

The MIT License.

Authors

l3wrapper was written by g8a9.

Metadata

Release files for l3wrapper 0.7.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 l3wrapper 0.7.0
File Size Uploaded Provenance Actions
l3wrapper-0.7.0.tar.gz 13.7 kB Without provenance Details for l3wrapper-0.7.0.tar.gz

Built distribution (wheel)

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

Total release size: 29.9 kB

Release files / l3wrapper-0.7.0.tar.gz

Download URL l3wrapper-0.7.0.tar.gz
Size 13.7 kB
Tags Source
SHA-256 checksum
How to use checksums
33ca2fb2e4232f91ca7482ccefcd06f00c4c1cf69ac00311e1b253f2a85b2610
BLAKE2b-256 checksum
How to use checksums
d9e56a8e639defb0b7deb9d5958dfb472956ade3fa323806ebacbc32ec2abdb7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.3.1.post20200622 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

Release files / l3wrapper-0.7.0-py3-none-any.whl

Download URL l3wrapper-0.7.0-py3-none-any.whl
Size 16.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
544c139489ffc76aea175ae36779443f261f64ae04e352327ba3732ec8319a91
BLAKE2b-256 checksum
How to use checksums
86a4f18d0ecb4009a130d9541d6e1507251b212d773dc99542c224f24ba70d52
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.3.1.post20200622 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

Security for l3wrapper 0.7.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