Random forest classification rules mining package
Project description
Random Forest Rules
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()
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file randomForestRules-lukassykora-1.1.2.tar.gz
.
File metadata
- Download URL: randomForestRules-lukassykora-1.1.2.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 789347700b4e62f998135423f5c3fe16b3c383d1a0dc4c421f36e5c67e9e749b |
|
MD5 | 21aa9f37c3cdb8f85afb4af4b888ea25 |
|
BLAKE2b-256 | dac0f82ca47b26db79d3faf0f05ff032043aab0eb9e74fafc614b53c5ba9a6b2 |
File details
Details for the file randomForestRules_lukassykora-1.1.2-py3-none-any.whl
.
File metadata
- Download URL: randomForestRules_lukassykora-1.1.2-py3-none-any.whl
- Upload date:
- Size: 6.5 kB
- Tags: Python 3
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b419fd73952b668c5891551c42f7babb015441f592b0901558de66e01e70e117 |
|
MD5 | 95d1c5820e919c84a7d2d823e68af037 |
|
BLAKE2b-256 | 053c19f41c9d3f7dfeff2f494d799f58087704048ace227a55b98644caec9522 |