Skip to content

Commit efca864

Browse files
committed
removed AutoTs explainability
1 parent 4629ba5 commit efca864

File tree

2 files changed

+11
-59
lines changed

2 files changed

+11
-59
lines changed

ads/opctl/operator/lowcode/forecast/model/autots.py

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -328,41 +328,7 @@ def _generate_report(self) -> tuple:
328328
)
329329

330330
def _custom_predict_autots(self, data):
331-
"""
332-
Predicts the future values of a time series using the AutoTS model.
333-
334-
Parameters
335-
----------
336-
data (numpy.ndarray): The input data to be used for prediction.
337-
338-
Returns
339-
-------
340-
numpy.ndarray: The predicted future values of the time series.
341-
"""
342-
343-
data.index = pd.to_datetime(data.index)
344-
temp_model = copy.deepcopy(self.models)
345-
346-
if data.shape[0] > 1:
347-
temp_model.fit_data(
348-
data[~data.index.duplicated()],
349-
future_regressor=self.future_regressor_train.head(-self.spec.horizon),
350-
)
351-
dedup_shape = data.shape[0] - data[~data.index.duplicated()].shape[0] + 1
352-
return pd.Series(0, index=np.arange(dedup_shape)).append(
353-
temp_model.back_forecast(
354-
tail=data[~data.index.duplicated()].shape[0] - 1
355-
)
356-
.forecast[self.spec.target_column]
357-
.fillna(0)
358-
)
359-
360-
return temp_model.predict(
361-
future_regressor=self.future_regressor_train.loc[
362-
self.future_regressor_train.index.isin(data.index)
363-
],
364-
forecast_length=1,
365-
).forecast[self.series_id]
331+
raise NotImplementedError("Autots does not yet support explanations.")
366332

367333
def _generate_train_metrics(self) -> pd.DataFrame:
368334
"""

ads/opctl/operator/lowcode/forecast/model/base_model.py

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -578,36 +578,22 @@ def explain_model(self, datetime_col_name, explain_predict_fn) -> dict:
578578
exp_start_time = time.time()
579579
global_ex_time = 0
580580
local_ex_time = 0
581+
logger.info(f"Calculating explanations using {self.spec.explanations_accuracy_mode} mode")
581582
for series_id in self.target_columns:
582583
self.series_id = series_id
583-
if self.spec.model == SupportedModels.AutoTS:
584-
self.dataset_cols = (
585-
self.full_data_long.loc[
586-
self.full_data_long.series_id == self.category_mapping[self.series_id]
587-
]
588-
.set_index(datetime_col_name)
589-
.columns
590-
)
591-
592-
self.bg_data = self.full_data_long.loc[
593-
self.full_data_long.series_id == self.category_mapping[self.series_id]
594-
].set_index(datetime_col_name)
595-
596-
else:
597-
self.dataset_cols = (
598-
self.full_data_dict.get(series_id)
599-
.set_index(datetime_col_name)
600-
.drop(series_id, axis=1)
601-
.columns
602-
)
584+
self.dataset_cols = (
585+
self.full_data_dict.get(series_id)
586+
.set_index(datetime_col_name)
587+
.drop(series_id, axis=1)
588+
.columns
589+
)
603590

604-
self.bg_data = self.full_data_dict.get(series_id).set_index(
605-
datetime_col_name
606-
)
591+
self.bg_data = self.full_data_dict.get(series_id).set_index(
592+
datetime_col_name
593+
)
607594
data = self.bg_data[list(self.dataset_cols)][: -self.spec.horizon][
608595
list(self.dataset_cols)]
609596
ratio = SpeedAccuracyMode.ratio[self.spec.explanations_accuracy_mode]
610-
logger.info(f"Calculating explanations using {self.spec.explanations_accuracy_mode} mode")
611597
data_trimmed = data.tail(max(int(len(data) * ratio), 100)).reset_index()
612598
data_trimmed[datetime_col_name] = data_trimmed[datetime_col_name].apply(lambda x: x.timestamp())
613599
kernel_explnr = PermutationExplainer(

0 commit comments

Comments
 (0)