] distsOT = dists_to_ot(dists) space = Space(corners) #Get the Data Base for UQ Case = Mascaret_new() X = Case.data_input x_l = X[0:799, :] x_t = X[800:999, :] # Build the learning sample #x_l = ot.LHSExperiment(ot.ComposedDistribution(distsOT), Nl, True, True).generate() #LHS distribution #x_l = [list(x_l[i]) for i in range(Nl)] #x_l = np.array(x_l) doe_l = doe(x_l) doe_t = doe(x_t) # Build the training sample #x_t = ot.LHSExperiment(ot.ComposedDistribution(distsOT), Nl, True, True).generate() #LHS distribution #x_t = [list(x_t[i]) for i in range(Nl)] #x_t = np.array(x_t) # Build Mascaret model via MascaretStudy class y_l = Case(x_l) y_t = Case(x_t) print('y_l', y_l) print('y_t', y_t) # Build the surrogate Model with UQ and loo/rmse/q2 criteria for each Surrogate # Kriging surrogate
from scipy.spatial import distance from sklearn import preprocessing from sklearn.neighbors import NearestNeighbors import matplotlib.pyplot as plt from matplotlib.patches import Circle from batman.space import Space from batman.visualization import doe, response_surface, reshow from batman.functions import Branin import openturns as ot # Problem definition: f(sample) -> data corners = np.array([[-5, 0], [10, 14]]) sample = Space(corners) sample.sampling(20) doe(sample, fname='init_doe.pdf') fun_branin = Branin() def fun(x): return -fun_branin(x) data = fun(sample) # Algo def random_uniform_ring( center=np.array([0, 0]), r_outer=1, r_inner=0, n_samples=1):
def test_doe_3D(self, ishigami_data, tmp): fig, ax = doe(ishigami_data.space, fname=os.path.join(tmp, 'DOE.pdf')) fig = reshow(fig) ax[0].plot([0, 6], [4, -3]) fig.savefig(os.path.join(tmp, 'DOE_change.pdf'))
def test_doe_mufi(self, ishigami_data, tmp): doe(ishigami_data.space, multifidelity=True, fname=os.path.join(tmp, 'DOE_mufi.pdf'))
def test_doe(self, mock_show, mascaret_data): doe(mascaret_data.space)