TimeSeriesPredictor.evaluate¶
- TimeSeriesPredictor.evaluate(data: TimeSeriesDataFrame | DataFrame | Path | str, model: str | None = None, metrics: str | TimeSeriesScorer | List[str | TimeSeriesScorer] | None = None, display: bool = False, use_cache: bool = True) Dict[str, float][source]¶
评估给定数据集的预测准确性。
该方法通过使用
data中每个时间序列的最后self.prediction_length个时间步长作为保留集来衡量预测准确性。- Parameters:
data (Union[TimeSeriesDataFrame, pd.DataFrame, Path, str]) –
用于评估最佳模型的数据。
data中每个时间序列的最后prediction_length个时间步长将被保留用于预测,并将在这些时间步长上计算预测准确性。必须包括历史和未来数据(即
data中所有时间序列的长度必须至少为prediction_length + 1)。如果在创建预测器时指定了
known_covariates_names,则data必须包括known_covariates_names中列出的列,并且协变量值必须与目标时间序列对齐。如果用于训练预测器的
train_data包含过去的协变量或静态特征,则data也必须包含它们(具有相同的列名和数据类型)。如果提供的数据是 pandas DataFrame 的实例,AutoGluon 将尝试自动将其转换为
TimeSeriesDataFrame。model (str, optional) – Name of the model that you would like to evaluate. By default, the best model during training (with highest validation score) will be used.
metrics (str, TimeSeriesScorer 或 List[Union[str, TimeSeriesScorer]], 可选) – 用于计算分数的指标或指标列表。默认为
self.eval_metric。支持字符串形式的指标名称和基于 TimeSeriesScorer 的自定义指标。display (bool, default = False) – 如果为True,分数将被打印出来。
use_cache (bool, default = True) – If True, will attempt to use the cached predictions. If False, cached predictions will be ignored. This argument is ignored if
cache_predictionswas set to False when creating theTimeSeriesPredictor.
- Returns:
scores_dict – 字典,其中键 = 指标,值 = 每个指标的性能。为了保持一致性,误差指标的符号将被翻转以遵守此约定。例如,将报告负的MAPE值。 要获取
eval_metric分数,请执行output[predictor.eval_metric.name]。- Return type:
Dict[str, float]