generated from LufsX/Experiment-LogReg
This commit is contained in:
+2
-2
@@ -29,8 +29,8 @@ def load_data(filepath):
|
||||
- X (numpy array): 特征数据
|
||||
- y (numpy array): 标签数据
|
||||
"""
|
||||
# 读取数据,指定缺失值符号为 '?'
|
||||
data = np.genfromtxt(filepath, delimiter=",", dtype=str)
|
||||
# 读取数据,指定分隔符为空格,缺失值符号为 '?'
|
||||
data = np.genfromtxt(filepath, delimiter=" ", dtype=str)
|
||||
|
||||
# 将 '?' 替换为 np.nan 并转换为浮点数
|
||||
data[data == '?'] = np.nan
|
||||
|
||||
Reference in New Issue
Block a user