generated from LufsX/Experiment-LogReg
This commit is contained in:
+2
-2
@@ -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()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user