marirena commited on
Commit
ed17a2c
·
verified ·
1 Parent(s): df69201

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -627,8 +627,8 @@ def update_data(example_df, Kitchen_afternoon_illuminance, Lounge_night_illumina
627
  for bar, score in zip(bars, scores_desc):
628
  text_color = 'black'
629
  text_value = f'{score[2]:.2f}'
630
- text_position = bar.get_width() - 0.015 if score[0] < 0 else bar.get_width() + 0.015 # Adjust the padding as needed
631
- plt.text(text_position, bar.get_y() + bar.get_height() / 2, text_value, ha='left' if score[0] < 0 else 'right', va='center', color=text_color, fontsize=20)
632
  plt.title("Feature Shap Values for Positive Prediction",fontsize=30)
633
  plt.ylabel("Feature", fontsize=28)
634
  plt.xlabel("SHAP Value", fontsize=28)
@@ -654,7 +654,7 @@ def update_data(example_df, Kitchen_afternoon_illuminance, Lounge_night_illumina
654
  text_color = 'black'
655
  text_value = f'{score[2]:.2f}'
656
  text_position = bar.get_width() - 0.015 if score[0] < 0 else bar.get_width() + 0.015 # Adjust the padding as needed
657
- plt.text(text_position, bar.get_y() + bar.get_height() / 2, text_value, ha='left' if score[0] < 0 else 'right', va='center', color=text_color, fontsize=20)
658
  plt.title("Feature Shap Values for Negative Prediction",fontsize=30)
659
  plt.ylabel("Feature", fontsize=28)
660
  plt.xlabel("SHAP Value", fontsize=28)
@@ -936,8 +936,8 @@ def return_original(example_df):
936
  for bar, score in zip(bars, scores_desc):
937
  text_color = 'black'
938
  text_value = f'{score[2]:.2f}'
939
- text_position = bar.get_width() - 0.08 if score[0] < 0 else bar.get_width() + 0.08 # Adjust the padding as needed
940
- plt.text(text_position, bar.get_y() + bar.get_height() / 2, text_value, ha='left' if score[0] < 0 else 'right', va='center', color=text_color, fontsize=20)
941
  plt.title("Feature Shap Values for Positive Prediction",fontsize=30)
942
  plt.ylabel("Feature", fontsize=28)
943
  plt.xlabel("Shap Value",fontsize=28)
@@ -963,8 +963,8 @@ def return_original(example_df):
963
  for bar, score in zip(bars, scores_desc):
964
  text_color = 'black'
965
  text_value = f'{score[2]:.2f}'
966
- text_position = bar.get_width() - 0.08 if score[0] < 0 else bar.get_width() + 0.08# Adjust the padding as needed
967
- plt.text(text_position, bar.get_y() + bar.get_height() / 2, text_value, ha='left' if score[0] < 0 else 'right', va='center', color=text_color, fontsize=20)
968
  plt.title("Feature Shap Values for Negative Prediction", fontsize=30)
969
  plt.ylabel("Feature",fontsize=28 )
970
  plt.xlabel("Shap Value",fontsize=28)
 
627
  for bar, score in zip(bars, scores_desc):
628
  text_color = 'black'
629
  text_value = f'{score[2]:.2f}'
630
+ text_position = bar.get_width() - 0.1 if score[0] < 0 else bar.get_width() + 0.1 # Adjust the padding as needed
631
+ plt.text(text_position, bar.get_y() + bar.get_height() / 2, text_value, ha='left' if score[0] < 0 else 'right', va='center', color=text_color, fontsize=18)
632
  plt.title("Feature Shap Values for Positive Prediction",fontsize=30)
633
  plt.ylabel("Feature", fontsize=28)
634
  plt.xlabel("SHAP Value", fontsize=28)
 
654
  text_color = 'black'
655
  text_value = f'{score[2]:.2f}'
656
  text_position = bar.get_width() - 0.015 if score[0] < 0 else bar.get_width() + 0.015 # Adjust the padding as needed
657
+ plt.text(text_position, bar.get_y() + bar.get_height() / 2, text_value, ha='left' if score[0] < 0 else 'right', va='center', color=text_color, fontsize=18)
658
  plt.title("Feature Shap Values for Negative Prediction",fontsize=30)
659
  plt.ylabel("Feature", fontsize=28)
660
  plt.xlabel("SHAP Value", fontsize=28)
 
936
  for bar, score in zip(bars, scores_desc):
937
  text_color = 'black'
938
  text_value = f'{score[2]:.2f}'
939
+ text_position = bar.get_width() - 0.1 if score[0] < 0 else bar.get_width() + 0.1 # Adjust the padding as needed
940
+ plt.text(text_position, bar.get_y() + bar.get_height() / 2, text_value, ha='left' if score[0] < 0 else 'right', va='center', color=text_color, fontsize=18)
941
  plt.title("Feature Shap Values for Positive Prediction",fontsize=30)
942
  plt.ylabel("Feature", fontsize=28)
943
  plt.xlabel("Shap Value",fontsize=28)
 
963
  for bar, score in zip(bars, scores_desc):
964
  text_color = 'black'
965
  text_value = f'{score[2]:.2f}'
966
+ text_position = bar.get_width() - 0.1 if score[0] < 0 else bar.get_width() + 0.1# Adjust the padding as needed
967
+ plt.text(text_position, bar.get_y() + bar.get_height() / 2, text_value, ha='left' if score[0] < 0 else 'right', va='center', color=text_color, fontsize=18)
968
  plt.title("Feature Shap Values for Negative Prediction", fontsize=30)
969
  plt.ylabel("Feature",fontsize=28 )
970
  plt.xlabel("Shap Value",fontsize=28)