From 3d61f41abf1e6967a288c48ce73a21ea1f893307 Mon Sep 17 00:00:00 2001 From: Desi <wyrzykala@sengi.de> Date: Tue, 4 Feb 2025 20:51:20 +0100 Subject: [PATCH] merge with main delete prints --- src/models/desi/call_poly.py | 7 +++++-- src/run_model_wrapper.py | 12 ++++++------ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/models/desi/call_poly.py b/src/models/desi/call_poly.py index 6309708..8e78309 100644 --- a/src/models/desi/call_poly.py +++ b/src/models/desi/call_poly.py @@ -8,7 +8,7 @@ from src.run_model_wrapper import main #optimal hyperparameters from autors: 'POLY': {'periodicity': 1, 'power': 4} params = { 'periodicity': [1, 2, 3], - 'power': [1, 2, 3, 4,5,7] + 'power': [1, 2, 3, 4,5] } def run_POLY(data, periodicity=1, power=3, n_jobs=1): @@ -22,4 +22,7 @@ model = 'POLY' output_path = '../../../docs/evaluation/' #writes results in .csv -main(run_POLY,params,model,data_folders = '../../../data/', model_type='unsupervised',output_dir = output_path) \ No newline at end of file +main(run_POLY,params,model,data_folders = '../../../data/', model_type='unsupervised',output_dir = output_path) + +#pip3 install -r requirements.txt +# python src/models/desi/call_poly.py \ No newline at end of file diff --git a/src/run_model_wrapper.py b/src/run_model_wrapper.py index 962618c..b72cb8d 100644 --- a/src/run_model_wrapper.py +++ b/src/run_model_wrapper.py @@ -261,11 +261,11 @@ def main(run_model, hyperparams, model_name, data_folders = '../../../data/', mo #go through all files in train data and store additionally informations about group and anomaly types grid_List = [] - print(f"Start Processing files") + # print(f"Start Processing files") #reutrns [{file_name:str,train_data:list,data:list, label:list, sliding_window:int}] file_data_dict_list = preprocess_data(path_data_all) - print('Start Hyperparameter Tuning') + # print('Start Hyperparameter Tuning') # Creates combinations of all hyperparameters param_combinations = list(itertools.product(*hyperparams.values())) #find hyperparametrs for each file: @@ -278,21 +278,21 @@ def main(run_model, hyperparams, model_name, data_folders = '../../../data/', mo # Hyperparameter-Optimierung best_params = hyperparameter_optimization(run_model, data,label,train_data, hyperparams,sliding_window,param_combinations,model_type) - print(f"File: {filename}, best hyperparameter: {best_params}") + # print(f"File: {filename}, best hyperparameter: {best_params}") #grid_list looks like this: [{ params: {key:value}, file_name:str,train_data:list,data:list, label:list, sliding_window:int}] grid_List.append({'file_name':filename,'params':best_params,'train_data':train_data,'data':data,'label':label,'sliding_window':sliding_window}) - print('Start Training and evaluation') + # print('Start Training and evaluation') results_list = train_test_model(run_model,grid_List,path_to_folder, model_type) #convert list of dicts to a dict with lists results = create_dict_from_array(results_list) #check duration time duration = sum(results['duration']) - print(f'Job done. Duration: {duration:.3f} seconds') + # print(f'Job done. Duration: {duration:.3f} seconds') #store results for each model by folder results_df = pd.DataFrame(results) output_csv = os.path.join(output_dir,model_name + '.csv') results_df.to_csv(output_csv, index=False) - print(f"Ergebnisse gespeichert in: {output_csv}") + # print(f"Ergebnisse gespeichert in: {output_csv}") -- GitLab