Skip to content

log_sklearn_plot: exception when plot params are passed. #812

@ocraft

Description

@ocraft

When plot params (title, x_label etc.) are passed, e.g.:

from dvclive import Live

with Live() as live:
  y_true = [0, 0, 1, 1]
  y_pred = [1, 0, 1, 0]
  y_score = [0.1, 0.4, 0.35, 0.8]
  live.log_sklearn_plot("roc", y_true, y_score)
  live.log_sklearn_plot(
    "confusion_matrix", y_true, y_pred, name="cm.json", title="Test")

the exception "TypeError: got an unexpected keyword argument 'title'" is thrown.

It's because of this line in the log_sklearn_plot method:

sklearn_kwargs = {
    k: v for k, v in kwargs.items() if k not in plot_config or k != "normalized"
}

The condition if k not in plot_config or k != "normalized" is always true for all params different that "normalized".

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions