generated from LufsX/Experiment-LogReg
This commit is contained in:
+7
-2
@@ -83,9 +83,14 @@ def load_data(filepath):
|
||||
for line in lines:
|
||||
line = line.strip().split()
|
||||
if len(line) >= 1 and line[-1].isdigit():
|
||||
line_data = [1] + [0 if x == '?' else float(x) for x in line[:-1]]
|
||||
line_data = [1] + [0 if x == '?' else float(x) for x in [line[i] for i in range(len(line) - 1) if i not in [2, 23, 24, 25, 26, 27]]]
|
||||
target = int(line[22])
|
||||
if target in [2, 3]:
|
||||
target = 0
|
||||
else:
|
||||
target = 1
|
||||
data.append(line_data)
|
||||
labels.append(int(line[-1]))
|
||||
labels.append(target)
|
||||
return np.array(data), np.array(labels)
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user