示例#1
0
def test_expand_corrmats_same():
    sub_corrmat = _get_corrmat(bo)
    np.fill_diagonal(sub_corrmat, 0)  # <- possible failpoint
    sub_corrmat_z = _r2z(sub_corrmat)
    weights = _rbf(test_model.locs, bo.locs)

    expanded_num_p, expanded_denom_p = _expand_corrmat_predict(sub_corrmat_z, weights)
    model_corrmat_p = np.divide(expanded_num_p, expanded_denom_p)
    expanded_num_f, expanded_denom_f = _expand_corrmat_predict(sub_corrmat_z, weights)
    model_corrmat_f = np.divide(expanded_num_f, expanded_denom_f)

    np.fill_diagonal(model_corrmat_f, 0)
    np.fill_diagonal(model_corrmat_p, 0)

    s = test_model.locs.shape[0] - bo.locs.shape[0]

    Kba_p = model_corrmat_p[:s, s:]
    Kba_f = model_corrmat_f[:s, s:]
    Kaa_p = model_corrmat_p[s:, s:]
    Kaa_f = model_corrmat_f[s:, s:]

    assert isinstance(Kaa_p, np.ndarray)
    assert isinstance(Kaa_f, np.ndarray)
    assert np.allclose(Kaa_p, Kaa_f, equal_nan=True)
    assert np.allclose(Kba_p, Kba_f, equal_nan=True)
示例#2
0
def test_expand_corrmat_predict():
    sub_corrmat = _get_corrmat(bo)
    np.fill_diagonal(sub_corrmat, 0)
    sub_corrmat = _r2z(sub_corrmat)
    weights = _rbf(test_model.locs, bo.locs)
    expanded_num_p, expanded_denom_p = _expand_corrmat_predict(sub_corrmat, weights)

    assert isinstance(expanded_num_p, np.ndarray)
    assert isinstance(expanded_denom_p, np.ndarray)
    assert np.shape(expanded_num_p)[0] == test_model.locs.shape[0]
示例#3
0
def test_get_corrmat():
    corrmat = _get_corrmat(data[0])
    assert isinstance(corrmat, np.ndarray)