gen / evaluations /evaluate_models.py
jaothan's picture
Upload 24 files
6f20934 verified
from sklearn.metrics import accuracy_score, f1_scoredef evaluate_model(model, X_test, y_test): """ Evaluate the model's performance on the test set. """ predictions = model.predict(X_test) accuracy = accuracy_score(y_test, predictions) f1 = f1_score(y_test, predictions, average='weighted') return {'accuracy': accuracy, 'f1_score': f1}