Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/dash-aix360-heart/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ cd dash-sample-apps/apps/dash-aix360-heart

Create and activate a conda env:
```
conda create -n dash-aix360-heart python=3.7.6
conda create -n dash-aix360-heart python=3.12
conda activate dash-aix360-heart
```

Or a venv (make sure your `python3` is 3.6+):
Or a venv (make sure your `python3` is 3.11 or 3.12):
```
python3 -m venv venv
source venv/bin/activate # for Windows, use venv\Scripts\activate.bat
Expand Down
7 changes: 3 additions & 4 deletions apps/dash-aix360-heart/app.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import dash
import dash_bootstrap_components as dbc
import dash_core_components as dcc
import dash_html_components as html
from dash import dcc, html
from dash.dependencies import Input, Output
import pandas as pd
import plotly.express as px
Expand All @@ -22,7 +21,7 @@ def Header(name, app):


def LabeledSelect(label, **kwargs):
return dbc.FormGroup([dbc.Label(label), dbc.Select(**kwargs)])
return html.Div([dbc.Label(label), dbc.Select(**kwargs)], className="mb-3")


# Compute the explanation dataframe, GAM, and scores
Expand Down Expand Up @@ -139,4 +138,4 @@ def update_figures(gam_col, coef_col):


if __name__ == "__main__":
app.run_server(debug=True)
app.run(debug=True)
15 changes: 15 additions & 0 deletions apps/dash-aix360-heart/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[project]
name = "dash-aix360-heart"
version = "0.1.0"
requires-python = ">=3.11,<3.13"
dependencies = [
"aix360>=0.3.0",
"cvxpy>=1.7.5",
"scikit-learn>=1.3.2,<1.4",
"numpy>=1.26.4,<2",
"pandas>=3.0.5",
"dash>=4.4.1",
"dash-bootstrap-components>=2.0.4",
"plotly>=7.0.0",
"gunicorn>=26.2.0",
]
150 changes: 54 additions & 96 deletions apps/dash-aix360-heart/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,96 +1,54 @@
absl-py==0.12.0
aix360==0.2.1
asgiref==3.3.4
astor==0.8.1
backcall==0.2.0
bleach==3.3.0
Brotli==1.0.9
cached-property==1.5.2
certifi==2020.12.5
chardet==4.0.0
click==8.0.1
cvxopt==1.2.6
cvxpy==1.1.13
cycler==0.10.0
Cython==0.29.23
dash==1.20.0
dash-bootstrap-components==0.12.2
dash-core-components==1.16.0
dash-html-components==1.1.3
dash-renderer==1.9.1
dash-table==4.11.3
decorator==4.4.2
Django==3.2.4
docutils==0.17.1
ecos==2.0.7.post1
Flask==2.0.1
Flask-Compress==1.9.0
future==0.18.2
gast==0.4.0
google-pasta==0.2.0
grpcio==1.38.0
gunicorn==20.1.0
h5py==3.2.1
idna==2.10
image==1.5.33
imageio==2.9.0
importlib-metadata==4.3.0
ipython-genutils==0.2.0
itsdangerous==2.0.1
Jinja2==3.0.1
joblib==1.0.1
Keras==2.3.1
Keras-Applications==1.0.8
Keras-Preprocessing==1.1.2
kiwisolver==1.3.1
lime==0.1.1.37
Markdown==3.3.4
MarkupSafe==2.0.1
matplotlib==3.4.2
networkx==2.5.1
numpy==1.20.3
osqp==0.6.2.post0
packaging==20.9
pandas==1.2.4
pexpect==4.8.0
pickleshare==0.7.5
Pillow==8.2.0
plotly==4.14.3
progressbar==2.5
protobuf==3.17.1
Pygments==2.9.0
pyparsing==2.4.7
python-dateutil==2.8.1
pytz==2021.1
PyWavelets==1.1.1
PyYAML==5.4.1
qdldl==0.1.5.post0
qpsolvers==1.6.1
quadprog==0.1.8
requests==2.25.1
retrying==1.3.3
scikit-image==0.18.1
scikit-learn==0.24.2
scipy==1.6.3
scs==2.1.3
shap==0.34.0
six==1.16.0
sqlparse==0.4.1
tensorboard==1.14.0
tensorflow==1.14.0
tensorflow-estimator==1.14.0
termcolor==1.1.0
threadpoolctl==2.1.0
tifffile==2021.4.8
torch==1.8.1
torchvision==0.9.1
tqdm==4.61.0
typing-extensions==3.10.0.0
urllib3==1.26.5
wcwidth==0.2.5
webencodings==0.5.1
Werkzeug==2.0.1
wrapt==1.12.1
xgboost==1.0.2
xport==3.2.1
zipp==3.4.1
aix360==0.3.0
annotated-types==0.8.0
blinker==1.9.0
certifi==2026.7.22
cffi==2.1.1
charset-normalizer==3.5.1
clarabel==0.11.1
click==8.5.0
cloudpickle==3.1.2
comm==0.2.3
contourpy==1.3.3
cvxpy==1.7.5
cycler==0.12.1
dash==4.4.1
dash-bootstrap-components==2.0.4
flask==3.1.3
fonttools==4.64.0
gunicorn==26.2.0
idna==3.19
importlib-metadata==9.0.1
itsdangerous==2.2.0
janus==2.0.0
jinja2==3.1.6
joblib==1.6.0
kiwisolver==1.5.1
markupsafe==3.0.3
matplotlib==3.11.1
narwhals==2.25.0
nest-asyncio==1.6.0
numpy==1.26.4
osqp==1.1.3
packaging==26.3
pandas==3.0.5
pillow==12.3.0
plotly==7.0.0
pycparser==3.0 ; implementation_name != 'PyPy'
pydantic==2.13.5
pydantic-core==2.46.5
pyparsing==3.3.2
python-dateutil==2.9.0.post0
requests==2.34.2
retrying==1.4.2
scikit-learn==1.3.2
scipy==1.17.1
scs==3.3.1
setuptools==84.0.0
six==1.17.0
threadpoolctl==3.6.0
typing-extensions==4.16.0
typing-inspection==0.4.4
tzdata==2026.3 ; sys_platform == 'emscripten' or sys_platform == 'win32'
urllib3==2.7.0
werkzeug==3.1.8
zipp==4.1.0
2 changes: 1 addition & 1 deletion apps/dash-aix360-heart/runtime.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
python-3.7.6
python-3.12.11
6 changes: 3 additions & 3 deletions apps/dash-aix360-heart/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def compute_plot_gam(model, Xorig, fb, features=None):
if (features is not None) and (f not in features):
continue
# Append term
terms = terms.append(pd.Series(model.lr.coef_[0, i], index=[(f, "", "")]))
terms = pd.concat([terms, pd.Series(model.lr.coef_[0, i], index=[(f, "", "")])])
# Initialize x values with min and max
xPlot[f] = [Xorig[f].min(), Xorig[f].max()]

Expand All @@ -45,7 +45,7 @@ def compute_plot_gam(model, Xorig, fb, features=None):
if (features is not None) and (f not in features):
continue
# Append new term
terms = terms.append(pd.Series(model.lr.coef_[0, i + nnzOrd], index=idxTerm))
terms = pd.concat([terms, pd.Series(model.lr.coef_[0, i + nnzOrd], index=idxTerm)])
# Update x values
if f not in xPlot:
if o in ["<=", ">"]:
Expand All @@ -68,7 +68,7 @@ def compute_plot_gam(model, Xorig, fb, features=None):
xPlot[f] = np.sort(np.array(xPlot[f]))
yPlot[f] = np.zeros_like(xPlot[f], dtype=float)
# Iterate over terms involving feature
for ((o, v), c) in terms[f].iteritems():
for ((o, v), c) in terms[f].items():
if o == "":
if model.useOrd and (f in fb.ordinal):
# Add linear function of standardized feature with same factor of 0.4
Expand Down
Loading