Skip to content

Instantly share code, notes, and snippets.

@TimSchmeier
Created October 15, 2020 22:38
Show Gist options
  • Save TimSchmeier/3d323a8c1c03140ede1ecf4486462592 to your computer and use it in GitHub Desktop.
Save TimSchmeier/3d323a8c1c03140ede1ecf4486462592 to your computer and use it in GitHub Desktop.
cdf normalization
import numpy as np
def normalize(arr):
# normalize a 1d to [0,1] using
# empirical cdf
idx = np.argsort(arr)
cdf = 1 - (idx / arr.size)
return cdf[idx]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment