def test_gauss_hermite_design_2(self): Y = dn.gauss_hermite_design([1, 1]) Ytrue = np.array([[0.0, 0.0]]) np.testing.assert_almost_equal(Y, Ytrue)
def test_gauss_hermite_design_2(self): Y = dn.gauss_hermite_design([1,1]) Ytrue = np.array([[0.0, 0.0]]) np.testing.assert_equal(Y, Ytrue)
def av_design(avmap, N, NMC=10): """Design on active variable space. A wrapper that returns the design for the response surface in the space of the active variables. Parameters ---------- avmap : ActiveVariableMap a domains.ActiveVariable map that includes the active variable domain, which includes the active and inactive subspaces N : int the number of points used in the design-of-experiments for constructing the response surface NMC : int, optional the number of points used to estimate the conditional expectation and conditional variance of the function given a value of the active variables (Default is 10) Returns ------- Y : ndarray N-by-n matrix that contains the design points in the space of active variables X : ndarray (N*NMC)-by-m matrix that contains points in the simulation input space to run the simulation ind : ndarray indices that map points in `X` to points in `Y` See Also -------- utils.designs.gauss_hermite_design utils.designs.interval_design utils.designs.maximin_design """ if not isinstance(avmap, ActiveVariableMap): raise TypeError('avmap should be an ActiveVariableMap.') # interpret N as total number of points in the design if not isinstance(N, int): raise Exception('N should be an integer.') if not isinstance(NMC, int): raise Exception('NMC should be an integer.') m, n = avmap.domain.subspaces.W1.shape if isinstance(avmap.domain, UnboundedActiveVariableDomain): NN = [int(np.floor(np.power(N, 1.0 / n))) for i in range(n)] Y = dn.gauss_hermite_design(NN) elif isinstance(avmap.domain, BoundedActiveVariableDomain): if n == 1: a, b = avmap.domain.vertY[0, 0], avmap.domain.vertY[1, 0] Y = dn.interval_design(a, b, N) else: vertices = avmap.domain.vertY Y = dn.maximin_design(vertices, N) else: raise Exception('There is a problem with the avmap.domain.') X, ind = avmap.inverse(Y, NMC) return Y, X, ind