diff --git a/function.py b/function.py index 897aec6..50c712c 100644 --- a/function.py +++ b/function.py @@ -27,7 +27,7 @@ name = "廖子豪" # 这里写自己的代码实现 -def load_data(filepath(horse-colic.test)): +def load_data(filepath): """ 从文件中加载数据。 @@ -49,6 +49,7 @@ def load_data(filepath(horse-colic.test)): X = np.nan_to_num(X, nan=np.nanmean(X, axis=0)) return X, y + def train_logreg(X, y, learning_rate=0.01, iterations=1000): """ 对率回归训练函数。 @@ -98,4 +99,4 @@ if __name__ == "__main__": # 测试单个数据 y_pred = predict_logreg(X_test[11], weights) - print(f"预测结果: {y_pred}, 实际结果: {y_test[11]}") + print(f"预测结果: {y_pred}, 实际结果: {y_test[11]}") \ No newline at end of file