sb-ai-lab / LightAutoML

Fast and customizable framework for automatic ML model creation (AutoML)
https://developers.sber.ru/portal/products/lightautoml
Apache License 2.0
1.08k stars 47 forks source link

The figsizes of the Repo Deco's graphs cannot be changed by usser #155

Closed enagovitsyn closed 1 week ago

enagovitsyn commented 2 weeks ago

🚀 Feature Request

In each plotting function in lightautoml.report.report_deco the figsize are fixed For example (3 line)

def plot_roc_curve_image(data, path):
    sns.set(style="whitegrid", font_scale=1.5)
    plt.figure(figsize=(10, 10))

    fpr, tpr, _ = roc_curve(data["y_true"], data["y_pred"])
    auc_score = roc_auc_score(data["y_true"], data["y_pred"])

    lw = 2
    plt.plot(fpr, tpr, color="blue", lw=lw, label="Trained model")
    plt.plot([0, 1], [0, 1], color="red", lw=lw, linestyle="--", label="Random model")
    plt.xlim([-0.05, 1.05])
    plt.ylim([-0.05, 1.05])
    plt.xlabel("False Positive Rate")
    plt.ylabel("True Positive Rate")
    lgd = plt.legend(bbox_to_anchor=(0.5, -0.15), loc="upper center", ncol=2)
    plt.xticks(np.arange(0, 1.01, 0.05), rotation=45)
    plt.yticks(np.arange(0, 1.01, 0.05))
    plt.grid(color="gray", linestyle="-", linewidth=1)
    plt.title("ROC curve (GINI = {:.3f})".format(2 * auc_score - 1))
    plt.savefig(path, bbox_extra_artists=(lgd,), bbox_inches="tight")
    plt.close()
    return auc_score

Motivation

I want to be able to set the size of the plots.

Proposal

Add an kwarg for the class

Additional context

In mlflow window view plots are don't fit completely

image
alexmryzhkov commented 1 week ago

Hi @enagovitsyn,

it’s sound like a bug in MLFlow because we are saving png images and they can be resized into any size after it in external applications