Edit on GitHub

scikit-learn

DVCLive allows you to add experiment tracking capabilities to your Scikit-learn projects.

Usage

You need to create a Live instance and include calls to log data.

DVCLive provides built-in functions to generate scikit learn plots, see Live.log_sklearn_plot().

The following snippet is used inside the Colab Notebook linked above:

from DVCLive import Live

...

with Live() as live:

    live.log_param("n_estimators", n_estimators)

    clf = RandomForestClassifier(n_estimators=n_estimators)
    clf.fit(X_train, y_train)

    y_train_pred = clf.predict(X_train)

    live.log_metric("train/f1", f1_score(y_train, y_train_pred, average="weighted"), plot=False)
    live.log_sklearn_plot(
        "confusion_matrix", y_train, y_train_pred, name="train/confusion_matrix",
        title="Train Confusion Matrix")

    y_test_pred = clf.predict(X_test)

    live.log_metric("test/f1", f1_score(y_test, y_test_pred, average="weighted"), plot=False)
    live.log_sklearn_plot(
        "confusion_matrix", y_test, y_test_pred, name="test/confusion_matrix",
        title="Test Confusion Matrix")
Content

๐Ÿ› Found an issue? Let us know! Or fix it:

Edit on GitHub

โ“ Have a question? Join our chat, we will help you:

Discord Chat