@@ -458,7 +458,20 @@ def train(args):
458458 pipeline = None
459459 if args .id :
460460 machine_id = args .id
461- pipeline = get_pipeline (data_path , pipeline_name , args .extractor , args .profile , args .target_hints , args .bg_hints , args .abs_pipeline_name , args .isolator , abs_trainer_names , dyn_trainer_names , energy_sources , valid_feature_groups )
461+ pipeline = get_pipeline (
462+ data_path ,
463+ pipeline_name ,
464+ args .extractor ,
465+ args .profile ,
466+ args .target_hints ,
467+ args .bg_hints ,
468+ args .abs_pipeline_name ,
469+ args .isolator ,
470+ abs_trainer_names ,
471+ dyn_trainer_names ,
472+ energy_sources ,
473+ valid_feature_groups ,
474+ )
462475 machine_spec_json = load_machine_spec (data_path , machine_id )
463476 if machine_spec_json is not None :
464477 new_spec = NodeTypeSpec ()
@@ -475,7 +488,9 @@ def train(args):
475488 for energy_source in energy_sources :
476489 energy_components = PowerSourceMap [energy_source ]
477490 for feature_group in valid_feature_groups :
478- success , abs_data , dyn_data = pipeline .process_multiple_query (input_query_results_list , energy_components , energy_source , feature_group = feature_group .name , replace_node_type = node_type )
491+ success , abs_data , dyn_data = pipeline .process_multiple_query (
492+ input_query_results_list , energy_components , energy_source , feature_group = feature_group .name , replace_node_type = node_type
493+ )
479494 assert success , f"failed to process pipeline { pipeline .name } "
480495 for trainer in pipeline .trainers :
481496 if trainer .feature_group == feature_group and trainer .energy_source == energy_source :
@@ -488,7 +503,11 @@ def train(args):
488503 if abs_data is not None :
489504 save_csv (data_saved_path , get_general_filename ("preprocess" , energy_source , feature_group , ModelOutputType .AbsPower , args .extractor ), abs_data )
490505 if dyn_data is not None :
491- save_csv (data_saved_path , get_general_filename ("preprocess" , energy_source , feature_group , ModelOutputType .DynPower , args .extractor , args .isolator ), dyn_data )
506+ save_csv (
507+ data_saved_path ,
508+ get_general_filename ("preprocess" , energy_source , feature_group , ModelOutputType .DynPower , args .extractor , args .isolator ),
509+ dyn_data ,
510+ )
492511
493512 print (f"=========== Train { energy_source } Summary ============" )
494513 # save args
@@ -580,7 +599,20 @@ def estimate(args):
580599 if pipeline_metadata is None :
581600 print (f"no metadata for pipeline { pipeline_name } ." )
582601 continue
583- pipeline = get_pipeline (data_path , pipeline_name , pipeline_metadata ["extractor" ], args .profile , args .target_hints , args .bg_hints , args .abs_pipeline_name , pipeline_metadata ["isolator" ], pipeline_metadata ["abs_trainers" ], pipeline_metadata ["dyn_trainers" ], energy_sources , valid_fg )
602+ pipeline = get_pipeline (
603+ data_path ,
604+ pipeline_name ,
605+ pipeline_metadata ["extractor" ],
606+ args .profile ,
607+ args .target_hints ,
608+ args .bg_hints ,
609+ args .abs_pipeline_name ,
610+ pipeline_metadata ["isolator" ],
611+ pipeline_metadata ["abs_trainers" ],
612+ pipeline_metadata ["dyn_trainers" ],
613+ energy_sources ,
614+ valid_fg ,
615+ )
584616 if pipeline is None :
585617 print (f"cannot get pipeline { pipeline_name } ." )
586618 continue
@@ -742,7 +774,16 @@ def plot(args):
742774 predicted_power_cols += [predicted_power_colname ]
743775 data_filename = get_general_filename (args .target_data , energy_source , fg , ot , args .extractor , args .isolator )
744776 # plot prediction
745- ts_plot (data , cols , f"{ energy_source } { ot .name } Prediction Result \n by { model_id } " , output_folder , f"{ data_filename } _{ model_id } " , subtitles = subtitles , labels = plot_labels , ylabel = "Power (W)" )
777+ ts_plot (
778+ data ,
779+ cols ,
780+ f"{ energy_source } { ot .name } Prediction Result \n by { model_id } " ,
781+ output_folder ,
782+ f"{ data_filename } _{ model_id } " ,
783+ subtitles = subtitles ,
784+ labels = plot_labels ,
785+ ylabel = "Power (W)" ,
786+ )
746787 # plot correlation to utilization if feature group is set
747788 if fg is not None :
748789 feature_cols = FeatureGroups [fg ]
@@ -751,7 +792,17 @@ def plot(args):
751792 # plot raw feature data to confirm min-max value
752793 ts_plot (data , feature_cols , f"Features { fg } " , output_folder , f"{ data_filename } _{ fg } " , labels = None , subtitles = None , ylabel = None )
753794 data [feature_cols ] = scaler .fit_transform (data [feature_cols ])
754- feature_power_plot (data , model_id , ot .name , energy_source , feature_cols , actual_power_cols , predicted_power_cols , output_folder , f"{ data_filename } _{ model_id } _corr" )
795+ feature_power_plot (
796+ data ,
797+ model_id ,
798+ ot .name ,
799+ energy_source ,
800+ feature_cols ,
801+ actual_power_cols ,
802+ predicted_power_cols ,
803+ output_folder ,
804+ f"{ data_filename } _{ model_id } _corr" ,
805+ )
755806
756807 elif args .target_data == "error" :
757808 from sklearn .preprocessing import MaxAbsScaler
@@ -964,7 +1015,9 @@ def run():
9641015 parser .add_argument ("-e" , "--energy-source" , type = str , help = "Specify energy source." , default = "rapl-sysfs" )
9651016 parser .add_argument ("--abs-trainers" , type = str , help = "Specify trainer names for train command (use comma(,) as delimiter)." , default = "default" )
9661017 parser .add_argument ("--dyn-trainers" , type = str , help = "Specify trainer names for train command (use comma(,) as delimiter)." , default = "default" )
967- parser .add_argument ("--trainers" , type = str , help = "Specify trainer names for train_from_data command (use comma(,) as delimiter)." , default = "XgboostFitTrainer" )
1018+ parser .add_argument (
1019+ "--trainers" , type = str , help = "Specify trainer names for train_from_data command (use comma(,) as delimiter)." , default = "XgboostFitTrainer"
1020+ )
9681021
9691022 # Validate arguments
9701023 parser .add_argument ("--benchmark" , type = str , help = "Specify benchmark file name." )
0 commit comments