当前位置: 首页>>代码示例>>Python>>正文


Python KrigingSurrogate.linearize方法代码示例

本文整理汇总了Python中openmdao.api.KrigingSurrogate.linearize方法的典型用法代码示例。如果您正苦于以下问题:Python KrigingSurrogate.linearize方法的具体用法?Python KrigingSurrogate.linearize怎么用?Python KrigingSurrogate.linearize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在openmdao.api.KrigingSurrogate的用法示例。


在下文中一共展示了KrigingSurrogate.linearize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_scalar_derivs

# 需要导入模块: from openmdao.api import KrigingSurrogate [as 别名]
# 或者: from openmdao.api.KrigingSurrogate import linearize [as 别名]
    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)
开发者ID:Mrbarhate,项目名称:OpenMDAO,代码行数:12,代码来源:test_kriging.py

示例2: test_vector_derivs

# 需要导入模块: from openmdao.api import KrigingSurrogate [as 别名]
# 或者: from openmdao.api.KrigingSurrogate import linearize [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.linearize(array([[0.5, 0.5]]))
        assert_rel_error(self, jac, array([[1, 1], [1, -1]]), 1e-5)
开发者ID:Mrbarhate,项目名称:OpenMDAO,代码行数:12,代码来源:test_kriging.py

示例3: test_vector_derivs

# 需要导入模块: from openmdao.api import KrigingSurrogate [as 别名]
# 或者: from openmdao.api.KrigingSurrogate import linearize [as 别名]
    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)
开发者ID:aa-savelyev,项目名称:OpenMDAO,代码行数:12,代码来源:test_kriging.py


注:本文中的openmdao.api.KrigingSurrogate.linearize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。