File size: 707 Bytes
d8485be
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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")