} n_runs = 5 for run_idx in np.arange(n_runs): X_train, y_train, rand_idx = dataset.create_dataset(x_grid.reshape(-1, 1), t_grid.reshape(-1, 1), n_samples=1000, noise=0.1, random=True, return_idx=True) theta = dataset.library(x_grid.reshape(-1, 1), t_grid.reshape(-1, 1), poly_order=2, deriv_order=3)[rand_idx, :] dt = dataset.time_deriv(x_grid.reshape(-1, 1), t_grid.reshape(-1, 1))[rand_idx, :] model = DeepMod(**config) optimizer = torch.optim.Adam(model.parameters(), betas=(0.99, 0.999), amsgrad=True) train(model, X_train, y_train, optimizer, 20000, loss_func_args={ 'library': torch.tensor(theta), 'time_deriv': torch.tensor(dt) }, log_dir=f'runs_new/deepmod_run_{run_idx}')
t = np.linspace(0.5, 5.0, 25) x_grid, t_grid = np.meshgrid(x, t, indexing='ij') # Making data dataset = Dataset(BurgersDelta, v=v, A=A) X_train, y_train = dataset.create_dataset(x_grid.reshape(-1, 1), t_grid.reshape(-1, 1), n_samples=0, noise=0.1, random=False) theta = dataset.library(x_grid.reshape(-1, 1), t_grid.reshape(-1, 1), poly_order=2, deriv_order=3) dt = dataset.time_deriv(x_grid.reshape(-1, 1), t_grid.reshape(-1, 1)) # Running deepmod config = { 'n_in': 2, 'hidden_dims': [30, 30, 30, 30, 30], 'n_out': 1, 'library_function': library_1D_in, 'library_args': { 'poly_order': 2, 'diff_order': 3 } } model = DeepMod(**config) optimizer = torch.optim.Adam(model.parameters(),