generated from LufsX/Experiment-LogReg
This commit is contained in:
+2
-2
@@ -92,13 +92,13 @@ def load_data(filepath):
|
|||||||
# 主逻辑
|
# 主逻辑
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
# 加载数据
|
# 加载数据
|
||||||
X, y = load_data('path_to_data_file.txt')
|
X, y = load_data("./data/horse-colic.data")
|
||||||
|
|
||||||
# 训练模型
|
# 训练模型
|
||||||
weights = train_logreg(X, y)
|
weights = train_logreg(X, y)
|
||||||
|
|
||||||
# 加载测试数据并预测
|
# 加载测试数据并预测
|
||||||
X_test, y_test = load_data('path_to_test_data_file.txt')
|
X_test, y_test = load_data("./data/horse-colic.test")
|
||||||
predictions = predict_logreg(X_test, weights)
|
predictions = predict_logreg(X_test, weights)
|
||||||
|
|
||||||
# 打印预测结果和实际结果
|
# 打印预测结果和实际结果
|
||||||
|
|||||||
Reference in New Issue
Block a user