更新 function.py
Gitea Actions Challenge Test / Challenge-Actions (push) Successful in 11s

This commit is contained in:
2024-10-06 18:33:48 +08:00
parent e623370e55
commit cbda375486
+8 -2
View File
@@ -80,8 +80,14 @@ def load_data(file_path):
values = line.strip().split("\t")
features.append([float(x) for x in values[:-1]])
labels.append(int(values[-1]))
return np.array(features), np.array(labels)
features = np.array(features)
labels = np.array(labels)
# 归一化特征值
scaler = StandardScaler()
features_scaled = scaler.fit_transform(features)
return features_scaled, labels, scaler # 返回归一化后的特征和缩放器对象
if __name__ == "__main__":