Skip to content

Instantly share code, notes, and snippets.

@Slater-Victoroff
Created March 10, 2014 08:07
Show Gist options
  • Save Slater-Victoroff/9461168 to your computer and use it in GitHub Desktop.
Save Slater-Victoroff/9461168 to your computer and use it in GitHub Desktop.
Normalization
def normalize(vector, span=(0,1)):
minimum, maximum = (np.min(vector), np.max(vector))
scaling = (span[1] - span[0]) / (maximum - minimum)
return ((vector - minimum) * scaling) + span[0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment