Skip to content

Commit c82ae2c

Browse files
author
SAAS R7 User1
committed
upload all for tf2.0
0 parents  commit c82ae2c

29 files changed

+22763
-0
lines changed

Diff for: .gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
scripts/*
2+
history/*
3+
data/*

Diff for: LICENSE

+674
Large diffs are not rendered by default.

Diff for: README.md

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Explainable-Neural-Networks
2+
3+
## Installation
4+
```shell
5+
pip install git+https://github.com/ajzhanghku/XNN.git
6+
# with token
7+
pip install git+https://[email protected]/ajzhanghku/XNN.git
8+
```
9+
10+
11+
## Usage
12+
- xNN
13+
14+
```python
15+
from xnn.xNN import xNN
16+
from xnn.SOSxNN import SOSxNN
17+
from xnn.visualizer import visualize_xnn, visualize_sosxnn
18+
19+
model = xNN(input_num = train_x.shape[1], input_dummy_num = 0, subnet_num = 10, subnet_layers = [10, 6], \
20+
task = "Regression", activation = tf.tanh, batch_size = min(1000, int(np.floor(train_x.shape[0]*0.20))), \
21+
training_epochs = 10000, beta_threshold = 0.05, tune_epochs = 500, lr_BP = 0.001, \
22+
l1_proj = 0.001, l1_subnet = 0.01, verbose = False, \
23+
val_ratio = 0.2, early_stop_thres = 2500)
24+
pred_train, tr_x, tr_y, pred_val, val_x, val_y = model.fit(train_x, train_y);
25+
pred_test = model.predict(test_x)
26+
visualize_xnn(simu_dir, "Demo_XNN", model, tr_x, dummy_name = None)
27+
```
28+
29+
30+
- SOSxNN
31+
```python
32+
model = SOSxNN(input_num = train_x.shape[1], input_dummy_num = 0, subnet_num = 10, subnet_layers = [10, 6], \
33+
task = "Regression", activation = tf.tanh, batch_size = min(1000, int(np.floor(train_x.shape[0]*0.20))), \
34+
training_epochs = 10000, beta_threshold = 0.05, tune_epochs = 500, lr_BP = 0.001, lr_CL= 0.1, \
35+
l1_proj = 0.001, l1_subnet = 0.01, smooth_lambda = 10**(-6), verbose = False, \
36+
val_ratio = 0.2, early_stop_thres = 2500)
37+
pred_train, tr_x, tr_y, pred_val, val_x, val_y = model.fit(train_x, train_y);
38+
pred_test = model.predict(test_x)
39+
visualize_sosxnn(simu_dir, "Demo_SOSxNN", model, tr_x, dummy_name = None)
40+
```
41+
42+
References
43+
----------
44+
J. Vaughan, A. Sudjianto, E. Brahimi, J. Chen, and V. N. Nair, "Explainable
45+
neural networks based on additive index models," The RMA
46+
Journal, pp. 40-49, October 2018.
47+
48+
Yang, Zebin, Aijun Zhang, and Agus Sudjianto. "Enhancing Explainability of
49+
Neural Networks through Architecture Constraints."
50+
arXiv preprint arXiv:1901.03838 (2019).

Diff for: examples/.ipynb_checkpoints/LC_interaction-checkpoint.ipynb

+233
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)