generated from LufsX/Experiment-LogReg
This commit is contained in:
+2
-1
@@ -82,7 +82,8 @@ def load_data(filepath):
|
||||
- np.array: 特征数据。
|
||||
- np.array: 标签数据。
|
||||
"""
|
||||
data = np.loadtxt(filepath, delimiter=',')
|
||||
# 使用 genfromtxt 来加载数据,并处理缺失值和错误的数据格式
|
||||
data = np.genfromtxt(filepath, delimiter=',', dtype=float, filling_values=np.nan)
|
||||
X = data[:, :-1]
|
||||
y = data[:, -1].astype(int)
|
||||
return X, y
|
||||
|
||||
Reference in New Issue
Block a user