Skip to content

Commit

Permalink
Change all explainer.show() to explainer.open_GUI()
Browse files Browse the repository at this point in the history
  • Loading branch information
szczepanskiNicolas committed Nov 28, 2023
1 parent 6629c66 commit 06e8d71
Show file tree
Hide file tree
Showing 19 changed files with 16 additions and 24 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ contrastive_reason = explainer.contrastive_reason()
print("contrastive reason", contrastive_reason)
print("to_features:", explainer.to_features(contrastive_reason, contrastive=True))

explainer.show()
explainer.open_GUI()
```

<img src="https://www.cril.univ-artois.fr/pyxai/assets/figures/pyxaiGUI.png" alt="pyxai" />
Expand Down
2 changes: 1 addition & 1 deletion pyxai/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ contrastive_reason = explainer.contrastive_reason()
print("contrastive reason", contrastive_reason)
print("to_features:", explainer.to_features(contrastive_reason, contrastive=True))

explainer.show()
explainer.open_GUI()
```

<img src="https://www.cril.univ-artois.fr/pyxai/assets/figures/pyxaiGUI.png" alt="pyxai" />
Expand Down
5 changes: 0 additions & 5 deletions pyxai/examples/BT/GUI-mnist38.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,6 @@ def get_pixel_value(instance, x, y, shape):
def instance_index_to_pixel_position(i, shape):
return i // shape[0], i % shape[0]

#explainer.show(image={"shape": (28,28),
# "dtype": numpy.uint8,
# "get_pixel_value": get_pixel_value,
# "instance_index_to_pixel_position": instance_index_to_pixel_position})

explainer.show_on_screen(instance, minimal_tree_specific_reason,
image={"shape": (28,28),
"dtype": numpy.uint8,
Expand Down
2 changes: 0 additions & 2 deletions pyxai/examples/BT/builder-simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,5 +81,3 @@
print("feat:", feat)
print("is_tree_specific:", explainer.is_tree_specific_reason(reason))
print("is_sufficient_reason:", explainer.is_sufficient_reason(reason))

#explainer.show()
2 changes: 1 addition & 1 deletion pyxai/examples/BT/regression/builder-regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

print("extremum", explainer.extremum_range())
print("possible range", explainer.range_for_partial_instance(instance))
explainer.show()
explainer.open_GUI()
#sufficient_reason = explainer.sufficient_reason()
#print("sufficient: ", sufficient_reason, explainer.to_features(sufficient_reason))
#print("is implicant:", explainer.is_implicant(sufficient_reason))
2 changes: 1 addition & 1 deletion pyxai/examples/BT/regression/simple-regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,4 @@
print("\ntree_specific: ", explainer.to_features(tree_specific_reason, eliminate_redundant_features=True))
print("is a tree specific", explainer.is_tree_specific_reason(tree_specific_reason))

explainer.show()
explainer.open_GUI()
1 change: 0 additions & 1 deletion pyxai/examples/BT/simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
# tree_specific_reason = explainer.tree_specific_reason(n_iterations=100)
# print("is a tree specific", explainer.is_tree_specific_reason(tree_specific_reason))

#explainer.show()
#minimal_tree_specific_reason = explainer.minimal_tree_specific_reason(time_limit=20)
#print("\nlen minimal tree_specific: ", len(minimal_tree_specific_reason))
#print("is a tree specific", explainer.is_tree_specific_reason(minimal_tree_specific_reason))
Expand Down
2 changes: 1 addition & 1 deletion pyxai/examples/DT/GUI-cifar.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def instance_index_to_pixel_position(i, shape):
value = i - (n_pixels*2)
return value // shape[0], value % shape[0]

explainer.show(image={"shape": (32,32,3),
explainer.open_GUI(image={"shape": (32,32,3),
"dtype": numpy.uint8,
"get_pixel_value": get_pixel_value,
"instance_index_to_pixel_position": instance_index_to_pixel_position})
2 changes: 1 addition & 1 deletion pyxai/examples/DT/GUI-mnist38-contrastives.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def get_pixel_value(instance, x, y, shape):
def instance_index_to_pixel_position(i, shape):
return i // shape[0], i % shape[0]

explainer.show(image={"shape": (28,28),
explainer.open_GUI(image={"shape": (28,28),
"dtype": numpy.uint8,
"get_pixel_value": get_pixel_value,
"instance_index_to_pixel_position": instance_index_to_pixel_position})
Expand Down
2 changes: 1 addition & 1 deletion pyxai/examples/DT/GUI-mnist38.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def instance_index_to_pixel_position(i, shape):

# Visualization part
explainer.heat_map("heat map 1", sufficient_reasons_per_attribute)
explainer.show(image={"shape": (28,28),
explainer.open_GUI(image={"shape": (28,28),
"dtype": numpy.uint8,
"get_pixel_value": get_pixel_value,
"instance_index_to_pixel_position": instance_index_to_pixel_position})
2 changes: 1 addition & 1 deletion pyxai/examples/DT/builder-loan.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@
for contrastive in contrastives:
print("contrastive:", explainer.to_features(contrastive, contrastive=True))

explainer.show()
explainer.open_GUI()
2 changes: 1 addition & 1 deletion pyxai/examples/DT/simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@
if all_are_contrastive:
print("All contrastive are ok")

explainer.show()
explainer.open_GUI()
2 changes: 1 addition & 1 deletion pyxai/examples/RF/GUI-australian.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@
#print("\ntree_specific: ", explainer.to_features(majoritary_reason))
#print("is majoritary:", explainer.is_majoritary_reason(majoritary_reason))

explainer.show()
explainer.open_GUI()
2 changes: 1 addition & 1 deletion pyxai/examples/RF/GUI-builder-loan.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@
print("contrastives (to_features):", explainer.to_features(contrastives[0], contrastive=True))
print("contrastives (to_features):", explainer.to_features(contrastives[1], contrastive=True))

explainer.show()
explainer.open_GUI()
2 changes: 1 addition & 1 deletion pyxai/examples/RF/GUI-mnist49.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def get_pixel_value(instance, x, y, shape):
def instance_index_to_pixel_position(i, shape):
return i // shape[0], i % shape[0]

explainer.show(image={"shape": (28,28),
explainer.open_GUI(image={"shape": (28,28),
"dtype": numpy.uint8,
"get_pixel_value": get_pixel_value,
"instance_index_to_pixel_position": instance_index_to_pixel_position})
Expand Down
2 changes: 1 addition & 1 deletion pyxai/examples/RF/builder-categorical-paper.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@
print("contrastive (to_features):", explainer.to_features(contrastive, contrastive=True))
print("is contrastive:", explainer.is_contrastive_reason(contrastive))

explainer.show()
explainer.open_GUI()
2 changes: 1 addition & 1 deletion pyxai/examples/RF/simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@
if explainer.elapsed_time == Explainer.TIMEOUT: print("Time out, this is an approximation")
print("is contrastive: ", explainer.is_contrastive_reason(minimal_constrative_reason))

explainer.show()
explainer.open_GUI()
2 changes: 1 addition & 1 deletion pyxai/examples/RF/theories-majoritary.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,4 @@
if explainer.elapsed_time == Explainer.TIMEOUT: print("Time out, this is an approximation")
print("is contrastive: ", explainer.is_contrastive_reason(minimal_constrative_reason))

explainer.show()
explainer.open_GUI()
2 changes: 1 addition & 1 deletion pyxai/examples/RF/theories-types-file.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@
features = explainer.to_features(majoritary_reason)
#print("features majoritary:", features)

explainer.show()
explainer.open_GUI()

0 comments on commit 06e8d71

Please sign in to comment.