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

This commit is contained in:
wzy
2024-10-26 18:20:03 +08:00
parent a9fb7b5eaa
commit e817959ca5
+1 -1
View File
@@ -30,7 +30,7 @@ name = "万子玉"
def sigmoid(z):
return 1 / (1 + np.exp(-z))
def train_logreg(X, y, learning_rate=0.001, iterations=1000, batch_size=32, initial_weights=None):
def train_logreg(X, y, learning_rate=0.001, iterations=500, batch_size=16, initial_weights=np.zeros(n_features + 1)):
X = np.insert(X, 0, 1, axis=1) # 添加偏置项
if initial_weights is None:
weights = np.zeros(X.shape[1])