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

This commit is contained in:
2024-11-03 20:00:23 +08:00
parent 23cee6d56a
commit 6337178f7c
+2 -1
View File
@@ -82,7 +82,8 @@ def load_data(filepath):
- np.array: 特征数据。 - np.array: 特征数据。
- np.array: 标签数据。 - np.array: 标签数据。
""" """
data = np.loadtxt(filepath, delimiter=',') # 使用 genfromtxt 来加载数据,并处理缺失值和错误的数据格式
data = np.genfromtxt(filepath, delimiter=',', dtype=float, filling_values=np.nan)
X = data[:, :-1] X = data[:, :-1]
y = data[:, -1].astype(int) y = data[:, -1].astype(int)
return X, y return X, y