def multi_burgers(self, loadnamenpy): fu_list = [] ICparams_list = [] grid_list = [] # Load simulation results fu, gridvars, ICparams = self.datamanager.loadSolution(loadnamenpy) difflearn = PDElearn(grid=PdfGrid(gridvars), fu=fu, ICparams=ICparams, trainratio=self.trainratio, debug=False, verbose=False) F = Features(scase=self.case, option=self.feature_opt, variableCoef=self.variableCoef, variableCoefOrder=self.variableCoefOrder, variableCoefBasis=self.variableCoefBasis) featurelist, labels, featurenames = F.makeFeatures( PdfGrid(gridvars), fu, ICparams) Xtrain, ytrain, Xtest, ytest = difflearn.makeTTsets(featurelist, labels, shuffle=False) # Fit data lin, rem_feature_idx = difflearn.train_sindy(Xtrain, ytrain, \ RegCoef=self.RegCoef, maxiter=self.maxiter, tolerance=self.tolerance, sindy_iter=self.sindy_iter, sindy_alpha=self.sindy_alpha) difflearn.print_full_report(lin, Xtrain, ytrain, Xtest, ytest, rem_feature_idx, featurenames) return difflearn, featurenames, Xtrain, ytrain, Xtest, ytest
def multiIC(self): fuk_list = [] fu_list = [] ICparams_list = [] grid_list = [] # Load simulation results for i in range(len(self.loadname_list)): if i >= self.numexamples: break fuk, fu, gridvars, ICparams = self.datamanager.loadSolution( self.loadname_list[i] + '.npy') difflearn = PDElearn(fuk=fuk, grid=PdfGrid(gridvars), fu=fu, ICparams=ICparams, trainratio=self.trainratio, debug=False, verbose=False) F = Features(scase=self.case, option=self.feature_opt, variableCoef=self.variableCoef, variableCoefOrder=self.variableCoefOrder, variableCoefBasis=self.variableCoefBasis) featurelist, labels, featurenames = F.makeFeatures( PdfGrid(gridvars), fu, ICparams) Xtrain, ytrain, Xtest, ytest = difflearn.makeTTsets(featurelist, labels, shuffle=False) #pdb.set_trace() if i == 0: Xall_train = Xtrain Xall_test = Xtest yall_train = ytrain yall_test = ytest else: Xall_train = np.concatenate((Xall_train, Xtrain), axis=0) yall_train = np.concatenate((yall_train, ytrain), axis=0) Xall_test = np.concatenate((Xall_test, Xtest), axis=0) yall_test = np.concatenate((yall_test, ytest), axis=0) # Fit data lin, rem_feature_idx = difflearn.train_sindy(Xall_train, yall_train, \ RegCoef=self.RegCoef, maxiter=self.maxiter, tolerance=self.tolerance, sindy_iter=self.sindy_iter, sindy_alpha=self.sindy_alpha) difflearn.print_full_report(lin, Xall_train, yall_train, Xall_test, yall_test, rem_feature_idx, featurenames) return difflearn, featurenames, Xall_train, yall_train, Xall_test, yall_test