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

This commit is contained in:
77
2024-11-01 21:59:58 +08:00
parent 255174f444
commit a6696a6f08
+4 -3
View File
@@ -86,8 +86,9 @@ def load_data(filepath):
return X, y
def main():
X_train, y_train = load_data("D:/data/horse/horse-colic.data")
X_test, y_test = load_data("D:/data/horse/horse-colic.test")
# 更新文件路径以匹配实际位置
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:
# 特征缩放
@@ -104,7 +105,7 @@ def main():
# 计算准确率
accuracy = np.mean(y_pred == y_test)
print(f"准确率: {accuracy}")
if __name__ == "__main__":
main()