def html_summary_table(data):
    """Generate HTML table of novelty detection statistics.
    
    data: dict
    A JSON like structure of the table data that has the following format:
    
    data = {
        'modelA': {
            'inlier_name': 'MNIST'
            'outliers': {
                'Fashion MNIST': {
                    'fpr_at_95_tpr': 0.02123,
                    'detection_error': 0.02373,
                    'auroc': 0.96573,
                    'aupr_in': 0.91231,
                    'aupr_out': 0.9852
                },
                'EMNIST Letters': {
                    'fpr_at_95_tpr': 0.02123,
                    'detection_error': 0.02373,
                    'auroc': 0.96573,
                    'aupr_in': 0.91231,
                    'aupr_out': 0.9852,
                }
            }
        },
        
        'modelB': {
            'inlier_name': 'MNIST'
            'outliers': {...}            
        }      
    }
    """
    
    table = """
        <table>
            <tr>
                <th>Model</th>
                <th>Out-of-distribution dataset</th>
                <th>FPR (95% TPR)</th>
                <th>Detection Error</th>
                <th>AUROC</th>
                <th>AUPR In</th>
                <th>AUPR Out</th>
            </tr>
    """

    for i, (model, model_data) in enumerate(data.items()):
        table += "<tr>"
        table += "<td rowspan={}><b>{}</b> ({})</td>".format(len(model_data['outliers']), model, model_data['inlier_name'])    

        for j, (outlier_name, scores) in enumerate(model_data['outliers'].items()):
            if j != 0:
                table += "<tr>"

            table += "<td>{}</td>".format(outlier_name)
            table += "<td>{:.1f}</td>".format(scores['fpr_at_95_tpr'] * 100)
            table += "<td>{:.1f}</td>".format(scores['detection_error'] * 100)
            table += "<td>{:.1f}</td>".format(scores['auroc'] * 100)
            table += "<td>{:.1f}</td>".format(scores['aupr_in'] * 100)
            table += "<td>{:.1f}</td>".format(scores['aupr_out'] * 100)
            table += "</tr>"

    table += "</table>"
    
    return table