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

This commit is contained in:
2024-11-03 17:39:41 +08:00
parent 7630f5afb2
commit a558b91c4f
+1 -3
View File
@@ -60,8 +60,7 @@ def load_data():
y = data['outcome'] y = data['outcome']
# 划分训练集和测试集 # 划分训练集和测试集
X_train, X_test = X.iloc[:300], X.iloc[300:] X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3, random_state=42)
y_train, y_test = y.iloc[:300], y.iloc[300:]
return X_train, X_test, y_train, y_test return X_train, X_test, y_train, y_test
@@ -88,4 +87,3 @@ if __name__ == "__main__":
y_pred = predict_logreg(model, X_test) y_pred = predict_logreg(model, X_test)
accuracy = evaluate_model(y_test, y_pred) accuracy = evaluate_model(y_test, y_pred)
print(f"Model Accuracy: {accuracy:.4f}") print(f"Model Accuracy: {accuracy:.4f}")