Skip to content

Commit

Permalink
remove final additivity check
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacmg committed Jun 20, 2024
1 parent 98a37d5 commit 0889399
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion flood_forecast/evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def evaluate_model(
else:
end_tensor = test_data.inverse_scale(end_tensor.detach().reshape(-1, 1))
end_tensor_list = flatten_list_function(end_tensor.numpy().tolist())
end_tensor = end_tensor.squeeze(1) # Removing extra dim from reshape?
end_tensor = end_tensor.squeeze(1) # Removing extra dim from reshape.?
history_length = model.params["dataset_params"]["forecast_history"]
if "n_targets" in model.params:
df_train_and_test.loc[df_train_and_test.index[history_length:],
Expand Down
4 changes: 2 additions & 2 deletions flood_forecast/explain_model_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ def deep_explain_model_summary_plot(
hist.cpu().numpy(), names=["batches", "observations", "features"]
)

shap_values = deep_explainer.shap_values(history)
shap_values = fix_shap_values(shap_values, history)
shap_values = deep_explainer.shap_values(history, check_additivity=False)
shap_values = fix_shap_values(shap_values, history, check_additivity=False)
shap_values = np.stack(shap_values)
if len(shap_values.shape) != 4:
shap_values = np.expand_dims(shap_values, axis=0)
Expand Down

0 comments on commit 0889399

Please sign in to comment.