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

This commit is contained in:
2024-10-31 23:33:16 +08:00
parent 242f28eb7e
commit f11d075a99
+3 -1
View File
@@ -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: