Created
March 23, 2019 10:29
-
-
Save missflash/29578dc5eeaef7bcc65e4ad9d4f35eef to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def normalize_feature(data, f_min=-1.0, f_max=1.0): | |
d_min, d_max = min(data), max(data) | |
factor = (f_max - f_min) / (d_max - d_min) | |
normalized = f_min + (data - d_min)*factor | |
return normalized, factor |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment