We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 015c6cf commit 2869292Copy full SHA for 2869292
1 file changed
normalize_data.py
@@ -0,0 +1,15 @@
1
+# Sebastian Raschka, 03/2014
2
+
3
+def normalize_val(x, data_list):
4
+ """
5
+ Normalizes a value to a data list returning a float
6
+ between 0.0 and 1.0.
7
+ Returns the original object if value is not a integer or float.
8
9
10
+ if isinstance(x, float) or isinstance(x, int):
11
+ numerator = x - min(data_list)
12
+ denominator = max(data_list) - min(data_list)
13
+ return numerator/denominator
14
+ else:
15
+ return x
0 commit comments