

def test_one_dim_bi_fidelity_training(self):
    mm = MultiFiMetaModel(nfi=2)
    mm.add_param('x', 0.0)
    surr = MockSurrogate()
    mm.add_output('y', 0.0, surrogate=surr)
    prob = Problem(Group())
    prob.root.add('mm', mm)
    prob.setup(check=False)
    prob['mm.train:x'] = [0.0, 0.4, 1.0]
    prob['mm.train:x_fi2'] = [0.1, 0.2, 0.3, 0.5, 0.6, 0.7, 0.8, 0.9, 0.0, 0.4, 1.0]
    prob['mm.train:y'] = [3.02720998, 0.11477697, 15.82973195]
    prob['mm.train:y_fi2'] = [(- 9.32828839), (- 8.31986355), (- 7.00778837), (- 4.54535129), (- 4.0747189), (- 5.30287702), (- 4.47456522), 1.85597517, (- 8.48639501), (- 5.94261151), 7.91486597]
    expected_xtrain = [np.array([[0.0], [0.4], [1.0]]), np.array([[0.1], [0.2], [0.3], [0.5], [0.6], [0.7], [0.8], [0.9], [0.0], [0.4], [1.0]])]
    expected_ytrain = [np.array([[3.02720998], [0.11477697], [15.82973195]]), np.array([[(- 9.32828839)], [(- 8.31986355)], [(- 7.00778837)], [(- 4.54535129)], [(- 4.0747189)], [(- 5.30287702)], [(- 4.47456522)], [1.85597517], [(- 8.48639501)], [(- 5.94261151)], [7.91486597]])]
    prob.run()
    np.testing.assert_array_equal(surr.xtrain[0], expected_xtrain[0])
    np.testing.assert_array_equal(surr.xtrain[1], expected_xtrain[1])
    np.testing.assert_array_equal(surr.ytrain[0], expected_ytrain[0])
    np.testing.assert_array_equal(surr.ytrain[1], expected_ytrain[1])

dataset/ETHPy150Open OpenMDAO/OpenMDAO/openmdao/components/test/test_multifi_meta_model.py MultiFiMetaModelTestCase.test_one_dim_bi_fidelity_training/original