Beispiel #1
0
def test_pyx_error():
    psx = np.array([0.1, 0.3, 0.6])
    ps, py, inv = test_latent_py_ps_inv()
    try:
        pyx = latent_algebra.compute_pyx(psx, nm, inv)
    except ValueError as e:
        assert ('should be (N, K)' in str(e))
    with pytest.raises(ValueError) as e:
        pyx = latent_algebra.compute_pyx(psx, nm, inv)
Beispiel #2
0
def test_pyx():
    psx = np.array([
        [0.1, 0.3, 0.6],
        [0.1, 0.0, 0.9],
        [0.1, 0.0, 0.9],
        [1.0, 0.0, 0.0],
        [0.1, 0.8, 0.1],
    ])
    ps, py, inv = test_latent_py_ps_inv()
    pyx = latent_algebra.compute_pyx(psx, nm, inv)
    assert (np.all(np.sum(pyx, axis=1) - 1 < 1e-4))