Best Python code snippet using fMBT_python
main.py
Source:main.py
...57 D = data_input_config.D58 Q = data_input_config.Q59 s = data_input_config.s60# model execute61model.model_execute(p, d, q, P, D, Q, s)62model.residuals_analysis()63model.acf_pacf_residuals()64model.ts_residuals_plot()65model.adjust_predict()...
main_test.py
Source:main_test.py
1from test import *2# Ignore warnings3import warnings4warnings.filterwarnings("ignore")5### Initialize6opt = Args()7opt.set_graphtype('pivotMds_grid')8#opt.scale = 4009print(opt.__dict__) 10### Modify the epoch number to the suitable value11epoch=150012# model_execute = "ModelName_DatasetName_TrialID"13# model_execute = "GraphLSTM_pyg-grid_v2-demo1"14model_execute = "GraphLSTM_pyg-pivotMds_grid-demo1"15model_name = 'model_'+model_execute+'_'+str(epoch)+'.pkl'16model_file = opt.main_data_folder + 'model_save/' + model_name17opt.DGL_input = False # Set this value as True, if the trained model is GraphLSTM_dgl; Otherwise, set it as False.18opt.PYG_input = True # Set this value as False, if the trained model is GraphLSTM_pyg; Otherwise, set it as False.19folder_prefix = opt.main_data_folder + 'testing_results/'20bfs_order = False21scale_constant = 122pred_scale_constant = 123PA_corrected = True24cpu_mode = False25Scale_corrected = True26### Clean Folder27if os.path.exists(folder_prefix):28 shutil.rmtree(folder_prefix)29if not os.path.exists(folder_prefix):30 os.mkdir(folder_prefix)31### Read Model32if cpu_mode == True:33 model = torch.load(model_file, map_location=lambda storage, loc: storage)34else:35 model = torch.load(model_file)36# ## Copy model in testing_results 37# shutil.copyfile(model_file,folder_prefix+model_name)38## Initialize Dataset39graph_dataset,valid_graph_dataset,test_graph_dataset = getdataset(opt)40## Begin test samples from test dataset41model_testdataset_inference_params = {42 "max_samples":24,43 "dataset":test_graph_dataset,44 "test_params":{45 "folder":folder_prefix+'test_random/',46 "model":model,47 "opt":opt,48 "cpu_mode":cpu_mode,49 "bfs_order":bfs_order,50 "Scale_corrected":Scale_corrected,51 "PA_corrected":PA_corrected,52 "scale_constant":scale_constant,53 "pred_scale_constant":pred_scale_constant54 }55}...
ModelExecuteDao.py
Source:ModelExecuteDao.py
...17 return query18 except Exception:19 print(traceback.print_exc())20 return False21def create_model_execute(model_execute):22 """23 å建 model_execute24 :param model_execute: ç±»å ModelExecute25 :return:26 """27 try:28 session = db.session29 session.add(model_execute)30 session.commit()31 print('æåå建ä¸æ¡æ§è¡è®°å½')32 return model_execute33 except Exception:34 print(traceback.print_exc())35 return False36def update_model_execute(model_execute_id, status, run_info, end_time):37 """38 æ´æ° model_execute39 :param model_execute_id:40 :param status:41 :param run_info:42 :param end_time:43 :return:44 """45 try:46 filters = {47 ModelExecute.id == model_execute_id,48 }49 result = ModelExecute.query.filter(*filters).first()50 result.status = status...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!