Skip to main content

Data Removal-Enabled Random Forests

Project description

DaRE RF: Data Removal-Enabled Random Forests

PyPi version Python version Github License Build

dare-rf is a python library that implements machine unlearning for random forests, enabling the efficient removal of training data without having to retrain from scratch. It is built using Cython and is designed to be scalable to large datasets.

thumbnail

Installation

pip install dare-rf

Usage

Simple example of removing a single training instance:

import dare
import numpy as np

# training data
X_train = np.array([[0, 1], [0, 1], [0, 1], [1, 0], [1, 0]])
y_train = np.array([1, 1, 1, 0, 1])

X_test = np.array([[1, 0]])  # test instance

# train a DaRE RF model
rf = dare.Forest(n_estimators=100,
                 max_depth=3,
                 k=5,  # no. thresholds to consider per attribute
                 topd=0,  # no. random node layers
                 random_state=1)
rf.fit(X_train, y_train)

rf.predict_proba(X_test)  # prediction before deletion => [0.5, 0.5]
rf.delete(3)  # delete training example at index 3 ([1, 0], 0)
rf.predict_proba(X_test)  # prediction after deletion => [0.0, 1.0]

License

Apache License 2.0.

Reference

Brophy and Lowd. Machine Unlearning for Random Forests. ICML 2021.

@inproceedings{brophy2021machine,
  title={Machine Unlearning for Random Forests},
  author={Brophy, Jonathan and Lowd, Daniel},
  booktitle={International Conference on Machine Learning},
  pages={1092--1104},
  year={2021},
  organization={PMLR}
}

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

dare-rf-1.0.2.tar.gz (965.5 kB view hashes)

Uploaded Source

Built Distributions

dare_rf-1.0.2-cp310-cp310-win_amd64.whl (1.4 MB view hashes)

Uploaded CPython 3.10 Windows x86-64

dare_rf-1.0.2-cp310-cp310-win32.whl (1.4 MB view hashes)

Uploaded CPython 3.10 Windows x86

dare_rf-1.0.2-cp310-cp310-musllinux_1_1_x86_64.whl (4.0 MB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.1+ x86-64

dare_rf-1.0.2-cp310-cp310-musllinux_1_1_i686.whl (3.8 MB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.1+ i686

dare_rf-1.0.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.0 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

dare_rf-1.0.2-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (3.9 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

dare_rf-1.0.2-cp310-cp310-macosx_10_9_x86_64.whl (1.5 MB view hashes)

Uploaded CPython 3.10 macOS 10.9+ x86-64

dare_rf-1.0.2-cp39-cp39-win_amd64.whl (1.4 MB view hashes)

Uploaded CPython 3.9 Windows x86-64

dare_rf-1.0.2-cp39-cp39-win32.whl (1.4 MB view hashes)

Uploaded CPython 3.9 Windows x86

dare_rf-1.0.2-cp39-cp39-musllinux_1_1_x86_64.whl (4.0 MB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.1+ x86-64

dare_rf-1.0.2-cp39-cp39-musllinux_1_1_i686.whl (3.9 MB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.1+ i686

dare_rf-1.0.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.0 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

dare_rf-1.0.2-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (3.9 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

dare_rf-1.0.2-cp39-cp39-macosx_10_9_x86_64.whl (1.5 MB view hashes)

Uploaded CPython 3.9 macOS 10.9+ x86-64

dare_rf-1.0.2-cp38-cp38-win_amd64.whl (1.4 MB view hashes)

Uploaded CPython 3.8 Windows x86-64

dare_rf-1.0.2-cp38-cp38-win32.whl (1.4 MB view hashes)

Uploaded CPython 3.8 Windows x86

dare_rf-1.0.2-cp38-cp38-musllinux_1_1_x86_64.whl (4.1 MB view hashes)

Uploaded CPython 3.8 musllinux: musl 1.1+ x86-64

dare_rf-1.0.2-cp38-cp38-musllinux_1_1_i686.whl (4.0 MB view hashes)

Uploaded CPython 3.8 musllinux: musl 1.1+ i686

dare_rf-1.0.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.0 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

dare_rf-1.0.2-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (4.0 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

dare_rf-1.0.2-cp38-cp38-macosx_10_9_x86_64.whl (1.5 MB view hashes)

Uploaded CPython 3.8 macOS 10.9+ x86-64

dare_rf-1.0.2-cp37-cp37m-win_amd64.whl (1.4 MB view hashes)

Uploaded CPython 3.7m Windows x86-64

dare_rf-1.0.2-cp37-cp37m-win32.whl (1.4 MB view hashes)

Uploaded CPython 3.7m Windows x86

dare_rf-1.0.2-cp37-cp37m-musllinux_1_1_x86_64.whl (3.9 MB view hashes)

Uploaded CPython 3.7m musllinux: musl 1.1+ x86-64

dare_rf-1.0.2-cp37-cp37m-musllinux_1_1_i686.whl (3.7 MB view hashes)

Uploaded CPython 3.7m musllinux: musl 1.1+ i686

dare_rf-1.0.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.8 MB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64

dare_rf-1.0.2-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (3.7 MB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

dare_rf-1.0.2-cp37-cp37m-macosx_10_9_x86_64.whl (1.5 MB view hashes)

Uploaded CPython 3.7m macOS 10.9+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page