from sklearn.metrics import ( ConfusionMatrixDisplay, confusion_matrix, accuracy_score, f1_score ) import tempfile from pathlib import Path from sklearn.datasets import load_iris from sklearn.linear_model import LogisticRegression from skops import card X, y = load_iris(return_X_y=True) model = LogisticRegression(solver="liblinear", random_state=0).fit(X, y) model_card = card.Card(model) model_card.metadata.license = "mit" y_pred = model.predict(X) model_card.add_metrics(**{ "accuracy": accuracy_score(y, y_pred), "f1 score": f1_score(y, y_pred, average="micro"), }) model_card.add_plot(confusion_matrix="confusion_matrix.png") model_card.save("README2.md")