generated from LufsX/Experiment-LogReg
This commit is contained in:
+2
-2
@@ -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__":
|
||||
|
||||
Reference in New Issue
Block a user