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

This commit is contained in:
Wyy
2024-11-02 21:40:08 +08:00
parent 8e9a0a3b29
commit d9b6dd8180
+1 -2
View File
@@ -4,8 +4,7 @@ id = "202210423224"
name = "吴杨洋"
def sigmoid(z):
"""Sigmoid 激活函数,添加 clipping 防止溢出"""
z = np.clip(z, -500, 500) # 限制 z 的值范围
z = np.clip(z, -500, 500) # 限制 z 的值范围以避免溢出
return 1 / (1 + np.exp(-z))
def train_logreg(X, y, numIter=1000, learning_rate=0.01, lambda_reg=0.01, batch_size=64):