Skip to content

Instantly share code, notes, and snippets.

View vatsaldin's full-sized avatar
☺️
I may be slow to respond.

Vatsal B. Desai vatsaldin

☺️
I may be slow to respond.
View GitHub Profile
@vatsaldin
vatsaldin / explainable_AI_disease_diagnosis.py
Last active January 1, 2021 03:34
surrogate model plot
surrogate_model.plot()
surrogate_model = explainer.model_surrogate(max_vars=6, max_depth=3)
surrogate_model.performance
@vatsaldin
vatsaldin / explainable_AI_disease_diagnosis.py
Last active January 1, 2021 03:47
plot a group of variables plot
explainer.model_profile().plot(variables=['TT4', 'FTI', 'TSH', 'T3'])
pd_rf = explainer.model_profile()
pd_rf.result
explainer.model_parts(type='shap_wrapper').plot()
explainer.model_performance()
@vatsaldin
vatsaldin / explainable_AI_disease_diagnosis.py
Last active January 1, 2021 03:49
model_parts().plot()
explainer.model_parts().plot()
@vatsaldin
vatsaldin / explainable_AI_disease_diagnosis.py
Last active January 1, 2021 03:48
create explainer object
explainer = dx.Explainer(model, X_train_df, Y_train_df, label='Hyporthyroidism')
@vatsaldin
vatsaldin / explainable_AI_disease_diagnosis.py
Last active January 1, 2021 03:48
Load saved pre-trained model
from keras.models import load_model
model = load_model('models/saved_model.h5')
@vatsaldin
vatsaldin / explainable_AI_disease_diagnosis.py
Last active January 1, 2021 03:52
Load and pre-process data
# Load dataset from csv using pandas
dataset = pd.read_csv('data/hypothyroid.csv')
dataset.head()
# Renaming the first column as target
dataset = dataset.rename(columns = {dataset.columns[0]:"target"})
dataset["target"] = dataset["target"].map({"negative":0,"hypothyroid":1})
# Replacing the categorical values into binary values
dataset = dataset.replace({'f':0,'t':1, 'y':1, 'n':0, 'M':0, 'F':1})