<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>immuneML: Clustering Split {{split_number}} Results</title>
    <style>
        {{{css_style}}}
    </style>
    <meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
    <div class="container">
        <div>
            <h1>Clustering Split {{split_number}} Results: {{name}}</h1>
            <p><a href="{{main_page_link}}">← Back to main results</a></p>

            <details>
                <summary>View Predictions</summary>
                <div class="results-grid">
                    <div>
                        <h4>Discovery</h4>
                        <a href="{{predictions.discovery.path}}">Download predictions</a>
                        <div class="prediction-table table-container">
                            {{{predictions.discovery.data}}}
                        </div>
                    </div>
                    {{#has_method_based}}
                    <div>
                        <h4>Method-based Validation</h4>
                        <a href="{{predictions.method_based.path}}">Download predictions</a>
                        <div class="prediction-table table-container">
                            {{{predictions.method_based.data}}}
                        </div>
                    </div>
                    {{/has_method_based}}
                    {{#has_result_based}}
                    <div>
                        <h4>Result-based Validation</h4>
                        <a href="{{predictions.result_based.path}}">Download predictions</a>
                        <div class="prediction-table table-container">
                            {{{predictions.result_based.data}}}
                        </div>
                    </div>
                    {{/has_result_based}}
                </div>
            </details>

            {{#performance.internal.show}}
            <h2>Internal Performance</h2>
            <p>
                The table below shows performance measured by internal performance metrics. This means that only the
                quality of the clusters was measured, without reference to any additional (labeled) information.
            </p>
            <h3>Discovery</h3>
            <div class="table-container padded">
                {{{performance.internal.discovery}}}
            </div>

            {{#has_method_based}}
            <h3>Method-based Validation</h3>
            <p>
                The clustering configuration (encoding, optional dimensionality reduction, clustering method) that
                created the clustering on discovery data is applied to validation
                data resulting in a new clustering of validation data - the clustering is refitted from scratch. These
                resulting clusterings on discovery and validation data can then be compared with internal, or external
                validation metrics. The focus is on the structural similarity of the clustering results as generated by
                the clustering configuration.
            </p>
            <div class="table-container padded">
                {{{performance.internal.method_based}}}
            </div>
            {{/has_method_based}}
            {{#has_result_based}}
            <h3>Result-based Validation</h3>
            <p>
                In result-based validation, the clustering for a given clustering configuration (encoding, optional
                dimensionality reduction, clustering method) is used to fit a supervised classifier that is then used
                to classify the validation data. This results in "transferred" clustering which can be compared to the
                original clustering on discovery data with respect to internal or external metrics. This approach
                focuses on whether the specific clustering result is also sensible for the validation data.
            </p>
            <div class="table-container padded">
                {{{performance.internal.result_based}}}
            </div>
            {{/has_result_based}}
            {{/performance.internal.show}}

            {{#performance.external.show}}
            <h2>External Performance</h2>
            <p>
                The tables below show performance measured by external performance metrics. This means that for each
                potential label of interest that was provided as input to the instruction, it was measured how well the
                clusters correspond to the label.
            </p>
            <h3>Discovery</h3>
            {{#performance.external.discovery}}
            <h4>Label: {{label}}</h4>
            <div class="table-container padded">
                {{{performance_table}}}
            </div>
            {{/performance.external.discovery}}

            {{#has_method_based}}
            <h3>Method-based Validation</h3>
            <p>
                The clustering configuration (encoding, optional dimensionality reduction, clustering method) that
                created the clustering on discovery data is applied to validation
                data resulting in a new clustering of validation data - the clustering is refitted from scratch. These
                resulting clusterings on discovery and validation data can then be compared with internal, or external
                validation metrics. The focus is on the structural similarity of the clustering results as generated by
                the clustering configuration.
            </p>
            {{#performance.external.method_based}}
            <h4>Label: {{label}}</h4>
            <div class="table-container padded">
                {{{performance_table}}}
            </div>
            {{/performance.external.method_based}}
            {{/has_method_based}}

            {{#has_result_based}}
            <h3>Result-based Validation</h3>
            <p>
                In result-based validation, the clustering for a given clustering configuration (encoding, optional
                dimensionality reduction, clustering method) is used to fit a supervised classifier that is then used
                to classify the validation data. This results in "transferred" clustering which can be compared to the
                original clustering on discovery data with respect to internal or external metrics. This approach
                focuses on whether the specific clustering result is also sensible for the validation data.
            </p>
            {{#performance.external.result_based}}
            <h4>Label: {{label}}</h4>
            <div class="table-container padded">
                {{{performance_table}}}
            </div>
            {{/performance.external.result_based}}
            {{/has_result_based}}
            {{/performance.external.show}}

            <h2>Detailed Results by Setting</h2>
            <ul class="setting-links">
                {{#setting_details}}
                <li><a href="{{path}}">{{name}}</a></li>
                {{/setting_details}}
            </ul>
        </div>
    </div>
</body>
</html> 