All Projects → SelfExplainML → Aletheia

SelfExplainML / Aletheia

Unwrapping Black Box of ReLU DNNs

Projects that are alternatives of or similar to Aletheia

Variational Autoencoder
Variational autoencoder implemented in tensorflow and pytorch (including inverse autoregressive flow)
Stars: ✭ 807 (+2782.14%)
Mutual labels:  deep-neural-networks
Csc deeplearning
3-day dive into deep learning at csc
Stars: ✭ 22 (-21.43%)
Mutual labels:  deep-neural-networks
Onnx Tensorflow
Tensorflow Backend for ONNX
Stars: ✭ 846 (+2921.43%)
Mutual labels:  deep-neural-networks
Ml Kws For Mcu
Keyword spotting on Arm Cortex-M Microcontrollers
Stars: ✭ 823 (+2839.29%)
Mutual labels:  deep-neural-networks
All Classifiers 2019
A collection of computer vision projects for Acute Lymphoblastic Leukemia classification/early detection.
Stars: ✭ 22 (-21.43%)
Mutual labels:  deep-neural-networks
Concise Ipython Notebooks For Deep Learning
Ipython Notebooks for solving problems like classification, segmentation, generation using latest Deep learning algorithms on different publicly available text and image data-sets.
Stars: ✭ 23 (-17.86%)
Mutual labels:  deep-neural-networks
Deep Learning Time Series
List of papers, code and experiments using deep learning for time series forecasting
Stars: ✭ 796 (+2742.86%)
Mutual labels:  deep-neural-networks
Dlt
Deep Learning Toolbox for Torch
Stars: ✭ 20 (-28.57%)
Mutual labels:  deep-neural-networks
Medicaldetectiontoolkit
The Medical Detection Toolkit contains 2D + 3D implementations of prevalent object detectors such as Mask R-CNN, Retina Net, Retina U-Net, as well as a training and inference framework focused on dealing with medical images.
Stars: ✭ 917 (+3175%)
Mutual labels:  deep-neural-networks
Nideep
collection of utilities to use with deep learning libraries (e.g. caffe)
Stars: ✭ 25 (-10.71%)
Mutual labels:  deep-neural-networks
Face Recognition
Face Recognition Using Keras/tensorflow coupled with Node.js Server
Stars: ✭ 16 (-42.86%)
Mutual labels:  deep-neural-networks
Deep Embedded Memory Networks
https://arxiv.org/abs/1707.00836
Stars: ✭ 19 (-32.14%)
Mutual labels:  deep-neural-networks
Zoneout Tensorflow
An implementation of zoneout regularizer on LSTM-RNN by Tensorflow
Stars: ✭ 23 (-17.86%)
Mutual labels:  deep-neural-networks
Kur
Descriptive Deep Learning
Stars: ✭ 811 (+2796.43%)
Mutual labels:  deep-neural-networks
Kalasalingam
IEEE "Invited Talk on Deep Learning" 03/02/2018
Stars: ✭ 13 (-53.57%)
Mutual labels:  deep-neural-networks
Quickdraw
Implementation of Quickdraw - an online game developed by Google
Stars: ✭ 805 (+2775%)
Mutual labels:  deep-neural-networks
Deepfake Detection
DeepFake Detection: Detect the video is fake or not using InceptionResNetV2.
Stars: ✭ 23 (-17.86%)
Mutual labels:  deep-neural-networks
Servenet
Service Classification based on Service Description
Stars: ✭ 21 (-25%)
Mutual labels:  deep-neural-networks
Tabnet
PyTorch implementation of TabNet paper : https://arxiv.org/pdf/1908.07442.pdf
Stars: ✭ 882 (+3050%)
Mutual labels:  deep-neural-networks
Tf Keras Surgeon
Pruning and other network surgery for trained TF.Keras models.
Stars: ✭ 25 (-10.71%)
Mutual labels:  deep-neural-networks

Aletheia

A Python package for unwrapping ReLU Neural Networks

Installation

The following environments are required:

  • Python 3.6, 3.7, 3.8 (Try Google Colab)
  • matplotlib>=3.1.3
  • numpy>=1.18
  • pandas>=1.1.2
  • seaborn>=0.9.0
  • scikit-learn>=0.23.0
  • csaps>=0.11.0
pip install aletheia-dnn

Usage

Load data

import numpy as np 
import pandas as pd 
import matplotlib.pyplot as plt
from sklearn.datasets import make_circles
from sklearn.model_selection import train_test_split

random_state = 0

x, y = make_circles(n_samples=2000, noise=0.1, random_state=random_state)
train_x, test_x, train_y, test_y = train_test_split(x, y, test_size=0.2, random_state=random_state)

plt.figure(figsize=(10,8))
scatter = plt.scatter(x[:, 0], x[:, 1], c=y)
plt.legend(*scatter.legend_elements(), loc="upper right")
plt.show()

Train a ReLU Net

from sklearn.neural_network import MLPClassifier
mlp = MLPClassifier(hidden_layer_sizes=[40] * 4, max_iter=2000, early_stopping=True, 
                    n_iter_no_change=100, validation_fraction=0.2,
                    solver='adam', activation="relu", random_state=random_state, 
                    learning_rate_init=0.001)
mlp.fit(train_x, train_y)

UnwrapperClassifier

from aletheia import *
clf = UnwrapperClassifier(mlp.coefs_, mlp.intercepts_)
clf.fit(train_x, train_y)
clf.summary()

CoCircleSummary

Partitioned regions

clf.visualize2D_regions(figsize=(8, 8), meshsize=300, show_label=False)

CoCircleRegions

Simplification

from sklearn.metrics import make_scorer, roc_auc_score
from sklearn.model_selection import GridSearchCV, PredefinedSplit
from sklearn.linear_model import LogisticRegressionCV, LogisticRegression

datanum = train_x.shape[0]
indices = np.arange(datanum)
idx1, idx2 = train_test_split(indices, test_size=0.2, random_state=random_state)
val_fold = np.ones((len(indices)))
val_fold[idx1] = -1

grid = GridSearchCV(MergerClassifier(unwrapper=None, 
                                     weights=mlp.coefs_, 
                                     biases=mlp.intercepts_,
                                     min_samples=30,
                                     n_neighbors=np.round(clf.nllms * 0.01).astype(int),
                                     refit_model=LogisticRegression()),
                                     param_grid={"n_clusters": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20]},
                                     scoring={"auc": make_scorer(roc_auc_score, needs_proba=True)},
                                     cv=PredefinedSplit(val_fold), refit="auc", n_jobs=10, error_score=np.nan)
grid.fit(train_x, train_y)
clf_merge = grid.best_estimator_
clf_merge.summary()

Local Inference

tmpid = 0
clf_merge.visualize2D_one_line(tmpid, figsize=(8, 8))
clf_merge.local_inference_wald(tmpid).round(4)

Citations

Agus Sudjianto, William Knauth, Rahul Singh, Zebin Yang and Aijun Zhang. 2020. Unwrapping The Black Box of Deep ReLU Networks: Interpretability, Diagnostics, and Simplification. arXiv:2011.04041

@article{sudjianto2020unwrapping,
  title={Unwrapping The Black Box of Deep ReLU Networks: Interpretability, Diagnostics, and Simplification},
  author={Sudjianto, Agus and Knauth, William and Singh, Rahul and Yang, Zebin and Zhang, Aijun},
  journal={arXiv:2011.04041},
  year={2020}
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].