本文整理汇总了Python中openmdao.api.KrigingSurrogate.jacobian方法的典型用法代码示例。如果您正苦于以下问题:Python KrigingSurrogate.jacobian方法的具体用法?Python KrigingSurrogate.jacobian怎么用?Python KrigingSurrogate.jacobian使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类openmdao.api.KrigingSurrogate
的用法示例。
在下文中一共展示了KrigingSurrogate.jacobian方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_vector_derivs
# 需要导入模块: from openmdao.api import KrigingSurrogate [as 别名]
# 或者: from openmdao.api.KrigingSurrogate import jacobian [as 别名]
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.jacobian(array([[0.5, 0.5]]))
assert_rel_error(self, jac, array([[1, 1], [1, -1]]), 1e-5)
示例2: test_scalar_derivs
# 需要导入模块: from openmdao.api import KrigingSurrogate [as 别名]
# 或者: from openmdao.api.KrigingSurrogate import jacobian [as 别名]
def test_scalar_derivs(self):
surrogate = KrigingSurrogate()
x = array([[0.], [1.], [2.], [3.]])
y = x.copy()
surrogate.train(x, y)
jac = surrogate.jacobian(array([[0.]]))
assert_rel_error(self, jac[0][0], 1., 1e-3)