Browse Source

Update preprocess.py

Signed-off-by: wmb <wmb@teknik.io>
master
wmb 1 year ago
parent
commit
934839cee1
  1. 10
      preprocess.py

10
preprocess.py

@ -35,8 +35,6 @@ def parse_data(attributes: list, line: str) -> list[float]: @@ -35,8 +35,6 @@ def parse_data(attributes: list, line: str) -> list[float]:
if attr["value-types"] == "numeric":
# Numeric field. Just copy it as is, we'll do the normalization later.
# Although keeping track of the min and max values for each field now
# would be more efficient.
parsed_data.append(float(field))
elif attr["value-types"] == "enum":
@ -56,12 +54,8 @@ def update_min_max(min_max: list[list[float]], parsed_line: list[float]) -> None @@ -56,12 +54,8 @@ def update_min_max(min_max: list[list[float]], parsed_line: list[float]) -> None
for fieldnum, field in enumerate(parsed_line):
oldmin = min_max[0][fieldnum]
oldmax = min_max[1][fieldnum]
if oldmin is None or field < oldmin:
min_max[0][fieldnum] = field
if oldmax is None or field > oldmax:
min_max[1][fieldnum] = field
#min_max[0][fieldnum] = field if oldmin is None or field < oldmin else oldmin
#min_max[1][fieldnum] = field if oldmax is None or field > oldmax else oldmax
min_max[0][fieldnum] = field if oldmin is None or field < oldmin else oldmin
min_max[1][fieldnum] = field if oldmax is None or field > oldmax else oldmax
def normalize(data: list[list[float]],
min_max: list[list[float]],

Loading…
Cancel
Save