File size: 610 Bytes
37351b6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import numpy as np

from reproduction.gpu_reproduction import summarize_sample_outputs


def test_sample_summary_reports_bias_variance_and_fidelity():
    reference = np.array([1.0, 2.0, -1.0])
    samples = np.array(
        [
            [1.0, 2.0, -1.0],
            [1.2, 1.8, -0.8],
            [0.8, 2.2, -1.2],
        ]
    )
    summary = summarize_sample_outputs(samples, reference)
    np.testing.assert_allclose(summary["bias_relative_l2"], 0.0, atol=1e-15)
    assert summary["mean_relative_l2"] > 0
    assert summary["mean_cosine_similarity"] < 1.0
    assert summary["empirical_mse_trace"] > 0