diff --git a/BayesValidRox/surrogate_models/surrogate_models.py b/BayesValidRox/surrogate_models/surrogate_models.py index dbfee1347000ff0df4657b5f43819edbd927a1ba..a9d8391c031748e3cf2cb8e849b17e2e1f784ad6 100644 --- a/BayesValidRox/surrogate_models/surrogate_models.py +++ b/BayesValidRox/surrogate_models/surrogate_models.py @@ -784,7 +784,8 @@ class Metamodel: self.gp_poly = self.AutoVivification() self.pca = self.AutoVivification() self.LCerror = self.AutoVivification() - + self.x_scaler = {} + if self.ExpDesignFlag != 'sequential': # Read observations or MCReference if Model.MeasurementFile is not None or len(Model.Observations) != 0: @@ -839,8 +840,14 @@ class Metamodel: # Parallel fit regression if self.metaModel.lower() == 'gpe': + # Prepare the input matrix + scaler = MinMaxScaler() + X_S = scaler.fit_transform(CollocationPoints) + + self.x_scaler[key] = scaler + outDict = Parallel(n_jobs=-1, prefer='threads')( - delayed(self.GaussianProcessEmulator)(CollocationPoints,OutputMatrix[:,idx]) + delayed(self.GaussianProcessEmulator)(X_S,OutputMatrix[:,idx]) for idx in range(OutputMatrix.shape[1])) for idx in range(OutputMatrix.shape[1]): self.gp_poly[key]["y_"+str(idx+1)] = outDict[idx] @@ -1941,8 +1948,9 @@ class Metamodel: # Perdiction with GPE if self.metaModel.lower() == 'gpe': + X_T = self.x_scaler[Outkey].transform(samples) gp = self.gp_poly[Outkey][Inkey] - y_mean, y_std = gp.predict(samples, return_std=True) + y_mean, y_std = gp.predict(X_T, return_std=True) else: # Perdiction with PCE or pcekriging # Assemble Psi matrix