Skip to content

Instantly share code, notes, and snippets.

@hanneshapke
Last active April 16, 2018 02:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hanneshapke/4f7831704b359a7fb19fb6ae14e4c544 to your computer and use it in GitHub Desktop.
Save hanneshapke/4f7831704b359a7fb19fb6ae14e4c544 to your computer and use it in GitHub Desktop.
Normalize the visualization heat map
def norm_heatmap(heatmap):
# element-wise maximum calculation, basically setting all negative values to zero
heatmap = np.maximum(heatmap, 0)
# normalizing the heatmap to values between 0 and 1
norm_heatmap = heatmap / np.max(heatmap)
return norm_heatmap
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment