From 00eee29cf4eaa14ada07066203aa5ffc51c1cfd3 Mon Sep 17 00:00:00 2001 From: wzy <675163717@qq.com> Date: Sat, 26 Oct 2024 18:54:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20function.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- function.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/function.py b/function.py index b23487d..0577f2b 100644 --- a/function.py +++ b/function.py @@ -30,7 +30,7 @@ name = "万子玉" def sigmoid(z): return 1 / (1 + np.exp(-z)) -def train_logreg(X, y, learning_rate=0.001, iterations=500, batch_size=16, initial_weights=np.zeros(n_features + 1)): +def train_logreg(X, y, learning_rate=0.001, iterations=500, batch_size=16, initial_weights=None): X = np.insert(X, 0, 1, axis=1) # 添加偏置项 if initial_weights is None: weights = np.zeros(X.shape[1])