From fbce23f64e423e321de2b491e9706626ae6b9ab1 Mon Sep 17 00:00:00 2001 From: Xionghaoran <719929980@qq.com> Date: Thu, 31 Oct 2024 15:22:22 +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 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/function.py b/function.py index dca9e83..b4be86e 100644 --- a/function.py +++ b/function.py @@ -107,4 +107,8 @@ if __name__ == "__main__": X_test, y_test = load_data("./data/horse-colic.test") # 训练对率回归模型 - weights = train_logreg( + weights = train_logreg(X_train, y_train, learning_rate=0.0005, iterations=3000, batch_size=32, lambda_=0.05) + + # 测试单个数据 + y_pred = predict_logreg(X_test[11], weights) + print(f"预测结果: {y_pred}, 实际结果: {y_test[11]}")