def test_train_camels(self): data_model = GagesModel.load_datamodel(self.config_data.data_path["Temp"], data_source_file_name='data_source.txt', stat_file_name='Statistics.json', flow_file_name='flow.npy', forcing_file_name='forcing.npy', attr_file_name='attr.npy', f_dict_file_name='dictFactorize.json', var_dict_file_name='dictAttribute.json', t_s_dict_file_name='dictTimeSpace.json') with torch.cuda.device(1): data_models = GagesModel.every_model(data_model) for i in range(len(data_models)): print("\n", "Training model", str(i + 1), ":\n") model, train_loss, valid_loss = master_train(data_models[i], valid_size=0.2) fig = plot_loss_early_stop(train_loss, valid_loss) out_dir = self.config_data.data_path["Out"] fig.savefig(os.path.join(out_dir, 'loss_plot.png'), bbox_inches='tight')
def test_train_gages_iter(self): data_model = GagesModel.load_datamodel(self.config_data.data_path["Temp"], data_source_file_name='data_source.txt', stat_file_name='Statistics.json', flow_file_name='flow.npy', forcing_file_name='forcing.npy', attr_file_name='attr.npy', f_dict_file_name='dictFactorize.json', var_dict_file_name='dictAttribute.json', t_s_dict_file_name='dictTimeSpace.json') valid_size = 0.2 with torch.cuda.device(1): for i in range(145, data_model.data_flow.shape[0]): print("\n", "Training model", str(i + 1), ":\n") data_models_i = GagesModel.which_data_model(data_model, i) model, train_loss, valid_loss = master_train_1by1(data_models_i, valid_size=valid_size) fig = plot_loss_early_stop(train_loss, valid_loss) out_dir = data_models_i.data_source.data_config.data_path["Out"] fig.savefig(os.path.join(out_dir, 'loss_plot.png'), bbox_inches='tight')
def test_train_valid_camels(self): data_model = CamelsModel.load_datamodel( self.config_data.data_path["Temp"], data_source_file_name='data_source.txt', stat_file_name='Statistics.json', flow_file_name='flow.npy', forcing_file_name='forcing.npy', attr_file_name='attr.npy', f_dict_file_name='dictFactorize.json', var_dict_file_name='dictAttribute.json', t_s_dict_file_name='dictTimeSpace.json') with torch.cuda.device(2): model, train_loss, valid_loss = master_train(data_model, valid_size=0.2) fig = plot_loss_early_stop(train_loss, valid_loss) out_dir = self.config_data.data_path["Out"] fig.savefig(os.path.join(out_dir, 'loss_plot.png'), bbox_inches='tight')