Created
March 8, 2018 20:25
-
-
Save a-r-d/e7504d57a0e05125ed68c60198e55489 to your computer and use it in GitHub Desktop.
how to scale factors
This file contains 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 featureScaling(arr): | |
_max = 0 | |
_min = 10000000 | |
for a in arr: | |
if a < _min: | |
_min = a | |
if a > _max: | |
_max = a | |
scaled = [] | |
for a in arr: | |
scaled.append((a - _min) / float((_max - _min))) | |
return scaled | |
data = [115, 140, 175] | |
print featureScaling(data) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment