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

This commit is contained in:
2024-11-10 14:56:36 +08:00
parent b40f917992
commit 0a2ec7f39c
+1 -1
View File
@@ -32,7 +32,7 @@ def sigmoid(z):
"""Sigmoid 激活函数。"""
return 1.0 / (1 + np.exp(-z))
def train_logreg(X, y, learning_rate=0.01, iterations=2000, batch_size=64, reg_lambda=0.01):
def train_logreg(X, y, learning_rate=0.01, iterations=1500, batch_size=64, reg_lambda=0.01):
"""训练逻辑回归模型的函数,使用梯度下降算法。"""
m, n = X.shape
weights = np.random.randn(n) * 0.01 # 初始化权重