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

This commit is contained in:
hao
2024-10-31 17:02:45 +08:00
parent c58baa453d
commit 7e90dfab2b
+2 -2
View File
@@ -72,9 +72,9 @@ def load_data(filepath):
- np.array: 特征数据。
- np.array: 标签数据。
"""
data = np.loadtxt(filepath, delimiter=',', dtype=float)
data = np.genfromtxt(filepath, delimiter=',', dtype=float, filling_values=0)
X = data[:, :-1]
y = (data[:, -1] > 0.5).astype(int) # Assuming the last column is the label
y = data[:, -1].astype(int) # 将标签列转换为整数类型
return X, y
if __name__ == "__main__":