generated from LufsX/Experiment-LogReg
This commit is contained in:
+3
-1
@@ -13,7 +13,6 @@ id = "202210423130"
|
||||
name = "董秋"
|
||||
|
||||
|
||||
# 这里写自己的代码实现
|
||||
def train_logreg(X, y, learning_rate=0.01, iterations=1000, lambda_reg=0.01):
|
||||
"""
|
||||
对率回归训练函数。
|
||||
@@ -75,6 +74,9 @@ def load_data(filepath):
|
||||
else:
|
||||
continue # 无效标签,丢弃
|
||||
|
||||
# 用0填充缺失值
|
||||
values = [0 if np.isnan(v) else v for v in values]
|
||||
|
||||
# 去掉特征3(索引2)和特征24~28(索引23-27)
|
||||
data.append(values[:2] + values[3:23]) # 保留特征1, 2 和特征4-23
|
||||
except ValueError:
|
||||
|
||||
Reference in New Issue
Block a user