generated from LufsX/Experiment-LogReg
This commit is contained in:
@@ -90,6 +90,10 @@ if __name__ == "__main__":
|
||||
# 加载测试集
|
||||
X_test, y_test = load_data("./data/horse-colic.test")
|
||||
|
||||
# 确保标签为浮点型,以防止整型溢出
|
||||
y_train = y_train.astype(float)
|
||||
y_test = y_test.astype(float)
|
||||
|
||||
# 训练对率回归模型
|
||||
weights = train_logreg(X_train, y_train, learning_rate=0.01, iterations=1000)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user