Skip to content

Write HTML table with confusion matrix in the HTML reports #26

Description

@FrancescoCasalegno

Context

  • As of now, when we run morphoclass evaluate, we generate a HTML report which includes various model performance metrics.

  • A confusion matrix is also included in this HTML report. But this confusion matrix is a PNG image:

    # model report on all samples
    cm_path = img_dir / "confusion_matrix.png"
    plot_confusion_matrix(
    metrics["confusion_matrix"], cm_path, labels=training_log.labels_str
    )
    report_html = f"""
    <div class="row">
    <br/><hr/><br/>
    <div class='col-md-6'>
    <h5>Average performance scores:</h5>
    <pre>{metrics["classification_report"]}</pre>
    </div>
    <div class='col-md-6'>
    <img src='file:{relative_to_html(cm_path)}' width='80%'>
    </div>
    </div>
    """
    report_html = textwrap.dedent(report_html).strip()

    Screenshot from 2022-04-20 15-50-29

  • This is inconvenient, because we may need to access programmatically the values in these confusion matrices later on.

Actions

  • Replace the PNG image with the confusion matrix by a HTML <table> element.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions