generated from LufsX/Experiment-LogReg
This commit is contained in:
+5
-2
@@ -54,8 +54,10 @@ def load_data(filepath):
|
||||
data, labels = [], []
|
||||
print(f"加载数据中: {filepath}")
|
||||
with open(filepath, 'r') as f:
|
||||
for line in f:
|
||||
for line_idx, line in enumerate(f):
|
||||
line = line.strip().split()
|
||||
if line_idx == 2: # 跳过第三行
|
||||
continue
|
||||
if len(line) >= 1 and line[-1].isdigit():
|
||||
line_data = [0 if x == '?' else float(x) for x in line[:-1]]
|
||||
data.append(line_data)
|
||||
@@ -66,7 +68,8 @@ def load_data(filepath):
|
||||
|
||||
num_features = data.shape[1]
|
||||
indices_to_remove = [2] # 去掉特征3(索引2)
|
||||
|
||||
|
||||
# 剔除特征 24-28(索引 23-27)
|
||||
if num_features > 23:
|
||||
indices_to_remove.extend(range(23, min(28, num_features)))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user