Skip to main content

Random Forest Rules

License: MIT

Get the representation of all rules found by sklearn RandomForestClassifier. It works in following way:

  • On each feature, it applies one-hot encoding that makes each column binary.
  • Random Forest runs on the features and a target attribute.
  • All trees are extracted from the Random Forest Regressor.
  • Decision Trees are split to classification rules.

GIT repository

https://github.com/lukassykora/randomForestRules

Installation

pip install randomForestRules-lukassykora

Jupyter Notebook

Example

from randomForestRules import RandomForestRules
import pandas as pd

df = pd.read_csv("data/audiology.csv")
df.columns = df.columns.str.replace("_", "-") # underscore not allowed
# All feature columns
cols=[]
for col in df.columns:
    if col != 'binaryClass':
        cols.append(col)
# Initialize
randomForest = RandomForestRules()
# Load data
randomForest.load_pandas(df)
# Fit
randomForest.fit(antecedent = cols, consequent = 'binaryClass', supp=0.005, conf=50)
# Get result
frame = randomForest.get_frame()

Release files for randomForestRules-lukassykora 1.1.2

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

Source distribution (sdist)

Source distribution for randomForestRules-lukassykora 1.1.2
File Size Uploaded
randomForestRules-lukassykora-1.1.2.tar.gz 5.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for randomForestRules-lukassykora 1.1.2
File Interpreter ABI Platform
randomForestRules_lukassykora-1.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 11.4 kB

Release files / randomForestRules-lukassykora-1.1.2.tar.gz

Download URL randomForestRules-lukassykora-1.1.2.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
789347700b4e62f998135423f5c3fe16b3c383d1a0dc4c421f36e5c67e9e749b
BLAKE2b-256 checksum
How to use checksums
dac0f82ca47b26db79d3faf0f05ff032043aab0eb9e74fafc614b53c5ba9a6b2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

Release files / randomForestRules_lukassykora-1.1.2-py3-none-any.whl

Download URL randomForestRules_lukassykora-1.1.2-py3-none-any.whl
Size 6.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b419fd73952b668c5891551c42f7babb015441f592b0901558de66e01e70e117
BLAKE2b-256 checksum
How to use checksums
053c19f41c9d3f7dfeff2f494d799f58087704048ace227a55b98644caec9522
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

Release history Release notifications | RSS feed

This release

1.1.2 This release

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.2

2 release files

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