From 1bd62be6a2a714c05fe840502273792bbe8edc03 Mon Sep 17 00:00:00 2001 From: 77 <3298722099@qq.com> Date: Fri, 1 Nov 2024 22:08:11 +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 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/function.py b/function.py index 51d9a63..f5f51df 100644 --- a/function.py +++ b/function.py @@ -86,10 +86,10 @@ def load_data(filepath): return X, y def main(): - # 更新文件路径以匹配实际位置 X_train, y_train = load_data("C:/Users/HP/Desktop/机器学习/Experiment-LogReg/data/horse-colic.data") X_test, y_test = load_data("C:/Users/HP/Desktop/机器学习/Experiment-LogReg/data/horse-colic.test") + if X_train is not None and X_test is not None: # 特征缩放 scaler = StandardScaler() @@ -105,7 +105,7 @@ def main(): # 计算准确率 accuracy = np.mean(y_pred == y_test) print(f"准确率: {accuracy}") - + if __name__ == "__main__": main()