

def test_one_dim_one_fidelity_training(self):
    mm = MultiFiMetaModel()
    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:y'] = [3.02720998, 0.11477697, 15.82973195]
    expected_xtrain = [np.array([[0.0], [0.4], [1.0]])]
    expected_ytrain = [np.array([[3.02720998], [0.11477697], [15.82973195]])]
    prob.run()
    np.testing.assert_array_equal(surr.xtrain, expected_xtrain)
    np.testing.assert_array_equal(surr.ytrain, expected_ytrain)
    expected_xpredict = 0.5
    prob['mm.x'] = expected_xpredict
    prob.run()
    np.testing.assert_array_equal(surr.xpredict, expected_xpredict)

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