Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
C
covid_analysis
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
COMPARA
covid_analysis
Commits
72d4fcce
Commit
72d4fcce
authored
Jun 27, 2024
by
Joaquin Torres
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated paths
parent
0aaace52
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
28 deletions
+28
-28
explainability/compute_shap_inter_vals.py
explainability/compute_shap_inter_vals.py
+5
-5
explainability/compute_shap_vals.py
explainability/compute_shap_vals.py
+5
-5
explainability/fit_final_models.py
explainability/fit_final_models.py
+13
-13
explainability/shap_plots.ipynb
explainability/shap_plots.ipynb
+5
-5
No files found.
explainability/compute_shap_inter_vals.py
View file @
72d4fcce
...
...
@@ -16,10 +16,10 @@ from sklearn.tree import DecisionTreeClassifier
# --------------------------------------------------------------------------------------------------------
def
read_test_data
(
attribute_names
):
# Load test data
X_test_pre
=
np
.
load
(
'../gen_train_data/
data/
output/pre/X_test_pre.npy'
,
allow_pickle
=
True
)
y_test_pre
=
np
.
load
(
'../gen_train_data/
data/
output/pre/y_test_pre.npy'
,
allow_pickle
=
True
)
X_test_post
=
np
.
load
(
'../gen_train_data/
data/
output/post/X_test_post.npy'
,
allow_pickle
=
True
)
y_test_post
=
np
.
load
(
'../gen_train_data/
data/
output/post/y_test_post.npy'
,
allow_pickle
=
True
)
X_test_pre
=
np
.
load
(
'../gen_train_data/output/pre/X_test_pre.npy'
,
allow_pickle
=
True
)
y_test_pre
=
np
.
load
(
'../gen_train_data/output/pre/y_test_pre.npy'
,
allow_pickle
=
True
)
X_test_post
=
np
.
load
(
'../gen_train_data/output/post/X_test_post.npy'
,
allow_pickle
=
True
)
y_test_post
=
np
.
load
(
'../gen_train_data/output/post/y_test_post.npy'
,
allow_pickle
=
True
)
# Type conversion needed
data_dic
=
{
...
...
@@ -36,7 +36,7 @@ if __name__ == "__main__":
# Setup
# --------------------------------------------------------------------------------------------------------
# Retrieve attribute names in order
attribute_names
=
list
(
np
.
load
(
'../gen_train_data/
data/
output/attributes.npy'
,
allow_pickle
=
True
))
attribute_names
=
list
(
np
.
load
(
'../gen_train_data/output/attributes.npy'
,
allow_pickle
=
True
))
# Reading data
data_dic
=
read_test_data
(
attribute_names
)
method_names
=
{
...
...
explainability/compute_shap_vals.py
View file @
72d4fcce
...
...
@@ -16,10 +16,10 @@ from sklearn.tree import DecisionTreeClassifier
# --------------------------------------------------------------------------------------------------------
def
read_test_data
(
attribute_names
):
# Load test data
X_test_pre
=
np
.
load
(
'../gen_train_data/
data/
output/pre/X_test_pre.npy'
,
allow_pickle
=
True
)
y_test_pre
=
np
.
load
(
'../gen_train_data/
data/
output/pre/y_test_pre.npy'
,
allow_pickle
=
True
)
X_test_post
=
np
.
load
(
'../gen_train_data/
data/
output/post/X_test_post.npy'
,
allow_pickle
=
True
)
y_test_post
=
np
.
load
(
'../gen_train_data/
data/
output/post/y_test_post.npy'
,
allow_pickle
=
True
)
X_test_pre
=
np
.
load
(
'../gen_train_data/output/pre/X_test_pre.npy'
,
allow_pickle
=
True
)
y_test_pre
=
np
.
load
(
'../gen_train_data/output/pre/y_test_pre.npy'
,
allow_pickle
=
True
)
X_test_post
=
np
.
load
(
'../gen_train_data/output/post/X_test_post.npy'
,
allow_pickle
=
True
)
y_test_post
=
np
.
load
(
'../gen_train_data/output/post/y_test_post.npy'
,
allow_pickle
=
True
)
# Type conversion needed
data_dic
=
{
...
...
@@ -36,7 +36,7 @@ if __name__ == "__main__":
# Setup
# --------------------------------------------------------------------------------------------------------
# Retrieve attribute names in order
attribute_names
=
list
(
np
.
load
(
'../gen_train_data/
data/
output/attributes.npy'
,
allow_pickle
=
True
))
attribute_names
=
list
(
np
.
load
(
'../gen_train_data/output/attributes.npy'
,
allow_pickle
=
True
))
# Reading data
data_dic
=
read_test_data
(
attribute_names
)
method_names
=
{
...
...
explainability/fit_final_models.py
View file @
72d4fcce
...
...
@@ -18,22 +18,22 @@ from sklearn.tree import DecisionTreeClassifier
# --------------------------------------------------------------------------------------------------------
def
read_training_data
(
attribute_names
):
# Load ORIGINAL training data
X_train_pre
=
np
.
load
(
'../gen_train_data/
data/
output/pre/X_train_pre.npy'
,
allow_pickle
=
True
)
y_train_pre
=
np
.
load
(
'../gen_train_data/
data/
output/pre/y_train_pre.npy'
,
allow_pickle
=
True
)
X_train_post
=
np
.
load
(
'../gen_train_data/
data/
output/post/X_train_post.npy'
,
allow_pickle
=
True
)
y_train_post
=
np
.
load
(
'../gen_train_data/
data/
output/post/y_train_post.npy'
,
allow_pickle
=
True
)
X_train_pre
=
np
.
load
(
'../gen_train_data/output/pre/X_train_pre.npy'
,
allow_pickle
=
True
)
y_train_pre
=
np
.
load
(
'../gen_train_data/output/pre/y_train_pre.npy'
,
allow_pickle
=
True
)
X_train_post
=
np
.
load
(
'../gen_train_data/output/post/X_train_post.npy'
,
allow_pickle
=
True
)
y_train_post
=
np
.
load
(
'../gen_train_data/output/post/y_train_post.npy'
,
allow_pickle
=
True
)
# Load oversampled training data
X_train_over_pre
=
np
.
load
(
'../gen_train_data/
data/
output/pre/X_train_over_pre.npy'
,
allow_pickle
=
True
)
y_train_over_pre
=
np
.
load
(
'../gen_train_data/
data/
output/pre/y_train_over_pre.npy'
,
allow_pickle
=
True
)
X_train_over_post
=
np
.
load
(
'../gen_train_data/
data/
output/post/X_train_over_post.npy'
,
allow_pickle
=
True
)
y_train_over_post
=
np
.
load
(
'../gen_train_data/
data/
output/post/y_train_over_post.npy'
,
allow_pickle
=
True
)
X_train_over_pre
=
np
.
load
(
'../gen_train_data/output/pre/X_train_over_pre.npy'
,
allow_pickle
=
True
)
y_train_over_pre
=
np
.
load
(
'../gen_train_data/output/pre/y_train_over_pre.npy'
,
allow_pickle
=
True
)
X_train_over_post
=
np
.
load
(
'../gen_train_data/output/post/X_train_over_post.npy'
,
allow_pickle
=
True
)
y_train_over_post
=
np
.
load
(
'../gen_train_data/output/post/y_train_over_post.npy'
,
allow_pickle
=
True
)
# Load undersampled training data
X_train_under_pre
=
np
.
load
(
'../gen_train_data/
data/
output/pre/X_train_under_pre.npy'
,
allow_pickle
=
True
)
y_train_under_pre
=
np
.
load
(
'../gen_train_data/
data/
output/pre/y_train_under_pre.npy'
,
allow_pickle
=
True
)
X_train_under_post
=
np
.
load
(
'../gen_train_data/
data/
output/post/X_train_under_post.npy'
,
allow_pickle
=
True
)
y_train_under_post
=
np
.
load
(
'../gen_train_data/
data/
output/post/y_train_under_post.npy'
,
allow_pickle
=
True
)
X_train_under_pre
=
np
.
load
(
'../gen_train_data/output/pre/X_train_under_pre.npy'
,
allow_pickle
=
True
)
y_train_under_pre
=
np
.
load
(
'../gen_train_data/output/pre/y_train_under_pre.npy'
,
allow_pickle
=
True
)
X_train_under_post
=
np
.
load
(
'../gen_train_data/output/post/X_train_under_post.npy'
,
allow_pickle
=
True
)
y_train_under_post
=
np
.
load
(
'../gen_train_data/output/post/y_train_under_post.npy'
,
allow_pickle
=
True
)
# Type conversion needed
data_dic
=
{
...
...
@@ -111,7 +111,7 @@ if __name__ == "__main__":
# Setup
# --------------------------------------------------------------------------------------------------------
# Retrieve attribute names in order
attribute_names
=
list
(
np
.
load
(
'../gen_train_data/
data/
output/attributes.npy'
,
allow_pickle
=
True
))
attribute_names
=
list
(
np
.
load
(
'../gen_train_data/output/attributes.npy'
,
allow_pickle
=
True
))
# Reading data
data_dic
=
read_training_data
(
attribute_names
)
method_names
=
{
...
...
explainability/shap_plots.ipynb
View file @
72d4fcce
...
...
@@ -35,13 +35,13 @@
"outputs": [],
"source": [
"# Retrieve attribute names in order\n",
"attribute_names = list(np.load('../gen_train_data/
data/
output/attributes.npy', allow_pickle=True))\n",
"attribute_names = list(np.load('../gen_train_data/output/attributes.npy', allow_pickle=True))\n",
"\n",
"# Load test data\n",
"X_test_pre = np.load('../gen_train_data/
data/
output/pre/X_test_pre.npy', allow_pickle=True)\n",
"y_test_pre = np.load('../gen_train_data/
data/
output/pre/y_test_pre.npy', allow_pickle=True)\n",
"X_test_post = np.load('../gen_train_data/
data/
output/post/X_test_post.npy', allow_pickle=True)\n",
"y_test_post = np.load('../gen_train_data/
data/
output/post/y_test_post.npy', allow_pickle=True)\n",
"X_test_pre = np.load('../gen_train_data/output/pre/X_test_pre.npy', allow_pickle=True)\n",
"y_test_pre = np.load('../gen_train_data/output/pre/y_test_pre.npy', allow_pickle=True)\n",
"X_test_post = np.load('../gen_train_data/output/post/X_test_post.npy', allow_pickle=True)\n",
"y_test_post = np.load('../gen_train_data/output/post/y_test_post.npy', allow_pickle=True)\n",
"\n",
"# Type conversion needed \n",
"data_dic = {\n",
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment