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

This commit is contained in:
2024-10-31 16:53:21 +08:00
parent 999b5e85f8
commit a8bf8e0971
+2 -2
View File
@@ -28,7 +28,7 @@ name = "董秋"
# 这里写自己的代码实现
def train_logreg(X, y, learning_rate=0.01, iterations=1000):
def train_logreg(X, y, learning_rate=0.01, iterations=1000,lambda_reg=0.01):
"""
对率回归训练函数。
@@ -98,7 +98,7 @@ if __name__ == "__main__":
X_test, y_test = load_data("./data/horse-colic.test")
# 训练对率回归模型
weights = train_logreg(X_train, y_train, learning_rate=0.01, iterations=1000)
weights = train_logreg(X_train, y_train, learning_rate=0.01, iterations=1000,lambda_reg=0.01)
# 测试单个数据
y_pred = predict_logreg(X_test[11], weights)