autogluon做时间序列预测

请问autogluon可以做时间序列预测任务吗?有实例代码可以参考吗,谢谢

以下是一个使用Autogluon进行时间序列预测的简单示例代码:

from autogluon.tabular import TabularDataset, TabularPredictor

train_data = TabularDataset('train.csv')
test_data = TabularDataset('test.csv')

label_column = 'target'
predictor = TabularPredictor(label=label_column, problem_type='regression')
predictor.fit(train_data)

predictions = predictor.predict(test_data)

上述代码使用Autogluon读取训练和测试数据,并指定目标变量的名称。然后,使用TabularPredictor类拟合模型,并使用predict方法进行预测。

注意,这只是一个简单的示例。在实际应用中,您可能需要对模型进行更多的调整和优化,以获得更好的性能。同时,您还需要根据数据集的特征进行适当的特征工程。

  • 这篇文章:【AutoGluon】原理 也许能够解决你的问题,你可以看下
  • 除此之外, 这篇博客: 自动超参数优化 AutoGluon 简单使用中的 超参数调优 部分也许能够解决你的问题, 你可以仔细阅读以下内容或跳转源博客中阅读:
  • // 你没看错,这个里也要超参数调优。 哈哈哈,用于调优模型的模型也是有参数的:

    使用:

    time_limit = 60  # for quick demonstration only, you should set this to longest time you are willing to wait (in seconds)
    metric = 'roc_auc'  # specify your evaluation metric here
    predictor = TabularPredictor(label, eval_metric=metric).fit(train_data, time_limit=time_limit, presets='best_quality')
    predictor.leaderboard(test_data, silent=True)
    

    参数说明:
    百度翻译:

    此命令实施以下策略以最大限度地提高准确性:
    
    1. 指定参数presets='best_quality',它允许 AutoGluon 基于stacking/ bagging 自动构建强大的模型集成,并且如果给予足够的训练时间,将大大改善结果预测。的默认值presets是 'medium_quality_faster_train',这会产生不太准确的模型,但有助于更快地进行原型设计。使用presets,您可以灵活地优先考虑预测准确性与训练/推理速度。例如,如果您不太关心预测性能并希望快速部署基本模型,请考虑使用: 。presets=['good_quality_faster_inference_only_refit', 'optimize_for_deployment']
    
    2. 提供eval_metric,如果你知道什么指标将用来评估你的应用程序的预测。您可能使用的其他一些非默认指标包括:('f1'用于二元分类)、'roc_auc'(用于二元分类)、 'log_loss'(用于分类)、'mean_absolute_error'(用于回归)、'median_absolute_error'(用于回归)。您还可以定义自己的自定义度量函数,请参阅文件夹中的示例:autogluon/core/metrics/
    
    3. 包括您的所有数据,train_data但不提供 tuning_data(AutoGluon 将更智能地拆分数据以满足其需求)。
    
    4. 不要指定hyperparameter_tune_kwargs参数(与直觉相反,超参数调整不是花费有限训练时间预算的最佳方式,因为模型集成通常更优)。我们建议您仅hyperparameter_tune_kwargs 在您的目标是部署单个模型而不是集成时使用。
    
    5. 不要指定hyperparameters参数(允许 AutoGluon 自适应地选择要使用的模型/超参数)。
    
    6. 设置time_limit为您愿意等待的最长时间(以秒为单位)。AutoGluon 的预测性能提高了fit()允许运行的时间越长。
    

    原文:

    This command implements the following strategy to maximize accuracy:
    
    Specify the argument presets='best_quality', which allows AutoGluon to automatically construct powerful model ensembles based on stacking/bagging, and will greatly improve the resulting predictions if granted sufficient training time. The default value of presets is 'medium_quality_faster_train', which produces less accurate models but facilitates faster prototyping. With presets, you can flexibly prioritize predictive accuracy vs. training/inference speed. For example, if you care less about predictive performance and want to quickly deploy a basic model, consider using: presets=['good_quality_faster_inference_only_refit', 'optimize_for_deployment'].
    
    Provide the eval_metric if you know what metric will be used to evaluate predictions in your application. Some other non-default metrics you might use include things like: 'f1' (for binary classification), 'roc_auc' (for binary classification), 'log_loss' (for classification), 'mean_absolute_error' (for regression), 'median_absolute_error' (for regression). You can also define your own custom metric function, see examples in the folder: autogluon/core/metrics/
    
    Include all your data in train_data and do not provide tuning_data (AutoGluon will split the data more intelligently to fit its needs).
    
    Do not specify the hyperparameter_tune_kwargs argument (counterintuitively, hyperparameter tuning is not the best way to spend a limited training time budgets, as model ensembling is often superior). We recommend you only use hyperparameter_tune_kwargs if your goal is to deploy a single model rather than an ensemble.
    
    Do not specify hyperparameters argument (allow AutoGluon to adaptively select which models/hyperparameters to use).
    
    Set time_limit to the longest amount of time (in seconds) that you are willing to wait. AutoGluon’s predictive performance improves the longer fit() is allowed to run.