@@ -327,7 +327,8 @@ def extract(args):
327327 if args .output :
328328 save_csv (data_path , "extracted_" + args .output , feature_power_data )
329329 query = feature_to_query (FeatureGroups [fg ][0 ])
330- query_results [query ][[TIMESTAMP_COL , query ]].groupby ([TIMESTAMP_COL ]).sum ().to_csv (args .output [0 :- 4 ]+ "_raw.csv" )
330+ raw_data = query_results [query ][[TIMESTAMP_COL , query ]].groupby ([TIMESTAMP_COL ]).sum ()
331+ save_csv (data_path , "extracted_" + args .output [0 :- 4 ]+ "_raw.csv" , raw_data )
331332 return feature_power_data , power_cols
332333
333334def isolate (args ):
@@ -407,10 +408,12 @@ def train(args):
407408 print_cols = ["feature_group" , "model_name" , "mae" ]
408409 print ("AbsPower pipeline results:" )
409410 metadata_df = load_pipeline_metadata (pipeline .path , energy_source , ModelOutputType .AbsPower .name )
410- print (metadata_df .sort_values (by = [ERROR_KEY ])[print_cols ])
411+ if metadata_df is not None :
412+ print (metadata_df .sort_values (by = [ERROR_KEY ])[print_cols ])
411413 print ("DynPower pipeline results:" )
412414 metadata_df = load_pipeline_metadata (pipeline .path , energy_source , ModelOutputType .DynPower .name )
413- print (metadata_df .sort_values (by = [ERROR_KEY ])[print_cols ])
415+ if metadata_df is not None :
416+ print (metadata_df .sort_values (by = [ERROR_KEY ])[print_cols ])
414417
415418 warnings .resetwarnings ()
416419
@@ -616,7 +619,7 @@ def _summary_plot(energy_source, summary_df, output_folder, name):
616619 sns .barplot (data = data , x = "Feature Group" , y = "MAE" , hue = "Model" , ax = ax )
617620 ax .set_title (component )
618621 ax .set_ylabel ("MAE (Watt)" )
619- ax .set_ylim ((0 , 50 ))
622+ ax .set_ylim ((0 , 100 ))
620623 if i < col_num - 1 :
621624 ax .set_xlabel ("" )
622625 ax .legend (bbox_to_anchor = (1.05 , 1.05 ))
@@ -671,7 +674,8 @@ def plot(args):
671674 from estimate import default_predicted_col_func
672675 from sklearn .preprocessing import MaxAbsScaler
673676
674- best_result_map , power_labels_map , best_model_id_map , _ = estimate (args )
677+ best_result_map , power_labels_map , best_model_id_map , summary_df = estimate (args )
678+ print (summary_df )
675679 for energy_source , best_restult in best_result_map .items ():
676680 best_restult = best_restult .reset_index ()
677681 power_labels = power_labels_map [energy_source ]
@@ -737,7 +741,7 @@ def export(args):
737741 machine_path = get_machine_path (output_path , args .version , machine_id )
738742
739743 collect_date , _ = extract_time (args .benchmark )
740- exporter .export (pipeline_path , machine_path , version = args .version , publisher = args .publisher , collect_date = collect_date , include_raw = args .include_raw )
744+ exporter .export (data_path , pipeline_path , machine_path , machine_id = machine_id , version = args .version , publisher = args .publisher , collect_date = collect_date , include_raw = args .include_raw )
741745
742746 args .energy_source = "," .join (PowerSourceMap .keys ())
743747
@@ -839,7 +843,6 @@ def plot_scenario(args):
839843 data_filename = get_general_filename (args .target_data , energy_source , None , ot , args .extractor , args .isolator ) + "_" + args .scenario
840844 _ts_plot (power_data , power_cols , "Power source: {} ({})" .format (energy_source , args .scenario ), output_folder , data_filename , ylabel = "Power (W)" )
841845
842-
843846if __name__ == "__main__" :
844847 # set model top path to data path
845848 os .environ ['MODEL_PATH' ] = data_path
0 commit comments