99import  sys 
1010from  typing  import  Dict , List 
1111
12- import  pandas  as  pd 
1312import  yaml 
1413
1514from  ads .opctl  import  logger 
1615from  ads .opctl .operator .common .const  import  ENV_OPERATOR_ARGS 
1716from  ads .opctl .operator .common .utils  import  _parse_input_args 
1817
19- from  .const  import  AUTO_SELECT_SERIES 
18+ from  .const  import  AUTO_SELECT ,  AUTO_SELECT_SERIES 
2019from  .model .forecast_datasets  import  ForecastDatasets , ForecastResults 
2120from  .operator_config  import  ForecastOperatorConfig 
2221from  .whatifserve  import  ModelDeploymentManager 
@@ -29,8 +28,10 @@ def operate(operator_config: ForecastOperatorConfig) -> ForecastResults:
2928    datasets  =  ForecastDatasets (operator_config )
3029    model  =  ForecastOperatorModelFactory .get_model (operator_config , datasets )
3130
32-     if  operator_config .spec .model  ==  AUTO_SELECT_SERIES  and  hasattr (
33-         operator_config .spec , "meta_features" 
31+     if  (
32+         operator_config .spec .model  ==  AUTO_SELECT_SERIES 
33+         and  hasattr (operator_config .spec , "meta_features" )
34+         and  operator_config .spec .target_category_columns 
3435    ):
3536        # For AUTO_SELECT_SERIES, handle each series with its specific model 
3637        meta_features  =  operator_config .spec .meta_features 
@@ -64,8 +65,6 @@ def operate(operator_config: ForecastOperatorConfig) -> ForecastResults:
6465            )
6566            sub_results_list .append (sub_results )
6667
67-             # results_df = pd.concat([results_df, sub_result_df], ignore_index=True, axis=0) 
68-             # elapsed_time += sub_elapsed_time 
6968        # Merge all sub_results into a single ForecastResults object 
7069        if  sub_results_list :
7170            results  =  sub_results_list [0 ]
@@ -75,6 +74,15 @@ def operate(operator_config: ForecastOperatorConfig) -> ForecastResults:
7574            results  =  None 
7675
7776    else :
77+         # When AUTO_SELECT_SERIES is specified but target_category_columns is not, 
78+         # we fall back to AUTO_SELECT behavior. 
79+         if  (
80+             operator_config .spec .model  ==  AUTO_SELECT_SERIES 
81+             and  not  operator_config .spec .target_category_columns 
82+         ):
83+ 
84+             operator_config .spec .model  =  AUTO_SELECT 
85+             model  =  ForecastOperatorModelFactory .get_model (operator_config , datasets )
7886        # For other cases, use the single selected model 
7987        results  =  model .generate_report ()
8088    # saving to model catalog 
0 commit comments