paddlets.xai.ante_hoc.tft_exp
- class TFTExplainer(*args, **kwargs)[source]
Bases:
TFTModelInherit TFT, and implement an explainer, which provides display of the explanation result.
- explain_backtest(data: TSDataset, start: Optional[Union[Timestamp, int, str, float]] = None, observation_index: Optional[int] = 0, horizons: Union[List[int], int] = [1], unit: Optional[str] = 'Units', display: Optional[bool] = True)[source]
Explain backtest data, the backtest logic is a simplied version of utils.backtest by setting predict_window and stride as out_chunk_len.
- Parameters
data (TSDataset) – The TSdataset used for successively generating explanation result and visualizing.
start (Union[pd.Timestamp, int, str ,float]) – The first prediction time, at which a prediction is computed for a future time.
observation_index (int, Optional) – The index with the dataset, corresponding to the observation for which the visualization will be generated.
horizons (Union[List[int], int]) – A list horizon, specified in time-steps units, for which the statistics will be computed.
unit (str, Optional) – The units associated with the time-steps. This variable is used for labeling the corresponding axes.
display (bool, Optional) – Whether to display the explanation results.
- Returns
Aggregated explanation data predicted by the model.
- Return type
Dict[str, np.ndarray]
- explain_prediction(data: TSDataset, horizons: Union[List[int], int] = [1], unit: Optional[str] = 'Units', display: Optional[bool] = True)[source]
Explain prediction data, in cases of single sample prediction.
- Parameters
data (TSDataset) – The TSdataset used for predicting explanation result and visualizing.
horizons (Union[List[int], int]) – A list or a single horizon, specified in time-steps units, for which the statistics will be computed.
unit (str, Optional) – The units associated with the time-steps. This variable is used for labeling the corresponding axes.
display (bool, Optional) – Whether to display the explanation results.
- Returns
Explanation data predicted by the model.
- Return type
Dict[str, np.ndarray]