コード例 #1
0
ファイル: test_kriging.py プロジェクト: colinxs/OpenMDAO
    def test_scalar_derivs(self):
        surrogate = KrigingSurrogate(nugget=0.)

        x = np.array([[0.], [1.], [2.], [3.]])
        y = x.copy()

        surrogate.train(x, y)
        jac = surrogate.linearize(np.array([[0.]]))

        assert_rel_error(self, jac[0][0], 1., 1e-3)
コード例 #2
0
ファイル: test_kriging.py プロジェクト: JustinSGray/openmdao
    def test_vector_derivs(self):
        surrogate = KrigingSurrogate()
        n = 15
        x = np.array([[a, b] for a, b in
                   itertools.product(np.linspace(0, 1, n), repeat=2)])
        y = np.array([[a+b, a-b, a+2*b] for a, b in x])

        surrogate.train(x, y)
        jac = surrogate.linearize(np.array([[0.5, 0.5]]))
        assert_near_equal(jac, np.array([[1, 1], [1, -1], [1, 2]]), 5e-4)
コード例 #3
0
ファイル: test_kriging.py プロジェクト: Mrbarhate/OpenMDAO
    def test_scalar_derivs(self):
        surrogate = KrigingSurrogate()

        x = array([[0.], [1.], [2.], [3.]])
        y = x.copy()

        surrogate.train(x, y)
        jac = surrogate.linearize(array([[0.]]))

        assert_rel_error(self, jac[0][0], 1., 1e-3)
コード例 #4
0
    def test_vector_derivs(self):
        surrogate = KrigingSurrogate()

        x = array([[a, b] for a, b in
                   itertools.product(linspace(0, 1, 10), repeat=2)])
        y = array([[a+b, a-b] for a, b in x])

        surrogate.train(x, y)
        jac = surrogate.linearize(array([[0.5, 0.5]]))
        assert_rel_error(self, jac, array([[1, 1], [1, -1]]), 1e-5)
コード例 #5
0
ファイル: test_kriging.py プロジェクト: aa-savelyev/OpenMDAO
    def test_vector_derivs(self):
        surrogate = KrigingSurrogate()
        n = 15
        x = np.array([[a, b] for a, b in
                   itertools.product(np.linspace(0, 1, n), repeat=2)])
        y = np.array([[a+b, a-b, a+2*b] for a, b in x])

        surrogate.train(x, y)
        jac = surrogate.linearize(np.array([[0.5, 0.5]]))
        assert_rel_error(self, jac, np.array([[1, 1], [1, -1], [1, 2]]), 5e-4)