Skip to content

Commit e165373

Browse files
committed
Added sample results
1 parent aa99b19 commit e165373

File tree

2 files changed

+28
-26
lines changed

2 files changed

+28
-26
lines changed

_shap.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ def __init__(
3333
):
3434
'''
3535
Different datasets need different alpha values for blending for better visualization
36+
37+
# 0.85 for IR_DISTRACTION
3638
'''
3739
self.blend_alpha = blend_alpha
3840
# set of background examples to take an expectation over

run_pipeline.py

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,22 @@
1010
create_directory(output_path)
1111

1212
config = {
13-
'lime': {
14-
'num_features': 128*128,
15-
'mask_features': 5,
16-
'num_samples': 1000,
17-
},
18-
'counterfactual': {
19-
'threshold_pct': 0.98,
20-
'block_size': 32
21-
},
13+
# 'lime': {
14+
# 'num_features': 128*128,
15+
# 'mask_features': 5,
16+
# 'num_samples': 1000,
17+
# },
18+
# 'counterfactual': {
19+
# 'threshold_pct': 0.98,
20+
# 'block_size': 32
21+
# },
2222
'shap': {
23-
'blend_alpha': 0.85,
23+
'blend_alpha': 0.7,
2424
'background_samples': 100
2525
},
26-
'elrp': {
27-
'max_loss_value': 1000
28-
},
26+
# 'elrp': {
27+
# 'max_loss_value': 1000
28+
# },
2929
'output_path': output_path,
3030
'test_data_path': join_paths(["TEST_SETS/", train_data.__name__, ""]),
3131
'train_data': train_data.data, # np.array of normal images
@@ -38,18 +38,18 @@
3838
rec_model = get_model(model_path)
3939
loss_model = get_model(model_path, rec=False)
4040

41-
p = Pipeline(rec_model, loss_model, config)
42-
p.run()
41+
# p = Pipeline(rec_model, loss_model, config)
42+
# p.run()
4343

44-
# output_path = config["output_path"]
45-
# test_path = config['test_data_path']
46-
# for category_dir in read_directory_contents(test_path):
47-
# category_type = os.path.split(category_dir)[-1]
48-
# INFO(category_type)
49-
# config["output_path"] = join_paths([output_path, category_type, ""])
50-
# config['data_name'] = category_type
51-
# create_directory(config["output_path"])
52-
# config['test_data_path'] = category_dir
44+
output_path = config["output_path"]
45+
test_path = config['test_data_path']
46+
for category_dir in read_directory_contents(test_path):
47+
category_type = os.path.split(category_dir)[-1]
48+
INFO(category_type)
49+
config["output_path"] = join_paths([output_path, category_type, ""])
50+
config['data_name'] = category_type
51+
create_directory(config["output_path"])
52+
config['test_data_path'] = category_dir
5353

54-
# _pipline = Pipeline(rec_model, loss_model, config)
55-
# _pipline.run()
54+
_pipline = Pipeline(rec_model, loss_model, config)
55+
_pipline.run()

0 commit comments

Comments
 (0)