Browse Source

Update preprocess.py

Signed-off-by: wmb <wmb@teknik.io>
tags/v0.1.0
wmb 5 months ago
parent
commit
934839cee1
1 changed files with 2 additions and 8 deletions
  1. 2
    8
      preprocess.py

+ 2
- 8
preprocess.py View File

@@ -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
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