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