Procházet zdrojové kódy

Update preprocess.py

Signed-off-by: wmb <wmb@teknik.io>
tags/v0.1.0
wmb před 7 měsíci
rodič
revize
934839cee1
1 změnil soubory, kde provedl 2 přidání a 8 odebrání
  1. 2
    8
      preprocess.py

+ 2
- 8
preprocess.py Zobrazit soubor

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

Načítá se…
Zrušit
Uložit