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

This commit is contained in:
77
2024-11-01 22:08:11 +08:00
parent 7690ce770a
commit 1bd62be6a2
+2 -2
View File
@@ -86,10 +86,10 @@ def load_data(filepath):
return X, y return X, y
def main(): def main():
# 更新文件路径以匹配实际位置
X_train, y_train = load_data("C:/Users/HP/Desktop/机器学习/Experiment-LogReg/data/horse-colic.data") 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") 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: if X_train is not None and X_test is not None:
# 特征缩放 # 特征缩放
scaler = StandardScaler() scaler = StandardScaler()
@@ -105,7 +105,7 @@ def main():
# 计算准确率 # 计算准确率
accuracy = np.mean(y_pred == y_test) accuracy = np.mean(y_pred == y_test)
print(f"准确率: {accuracy}") print(f"准确率: {accuracy}")
if __name__ == "__main__": if __name__ == "__main__":
main() main()