动态加权数据框中的每个观察结果,根据其时间戳,以使最近的观察产生更大的影响

发布于 2025-02-07 09:59:07 字数 726 浏览 0 评论 0原文

我正在设计一个模型,以预测足球的成绩,并最终成为最后的联赛桌。为此,我的训练集是从以前的联赛比赛中每个团队的基本指标和高级统计数据中得出的一组调整分数。由于战术,经理,播放器等的变化,我想对最近的游戏/固定装置提出更重要的重要性。

数据帧看起来像这样:

dateAttack_scoredefence_score
2022-03-182.30.4
2022-03-241.6 1.6 1.61.2
20222-2022-04-- 061.90.7

然后我计算得分的平均值。到目前为止,我引入时间因素的粗略方式是手动分配任意权重以分离这样的观察范围:

df['attack_score'].iloc[:-20].mean()*0.4 + df['attack_score'].iloc[-20:].mean()*0.6

但是,这是一种相当僵化的方法,并构成了我的模型的准确性。理想情况下,我想拥有一个函数,该函数可以在计算平均得分之前动态和逐步更新每个观察值的权重。

I'm designing a model to forecast football results and ultimately the final league table. For this purpose, my training set is a set of adjusted scores derived from the underlying metrics and advanced stats of each team in their previous league games. I want to assign more importance to recent games/fixtures because of changes in tactics, managers, players, etc.

The dataframe looks like this:

Dateattack_scoredefence_score
2022-03-182.30.4
2022-03-241.61.2
2022-04-061.90.7

Then I calculate the mean of the scores. So far, my crude way of introducing a time-factor has been to manually assign arbitrary weights to separate ranges of observations like this:

df['attack_score'].iloc[:-20].mean()*0.4 + df['attack_score'].iloc[-20:].mean()*0.6

However, this is a rather inflexible approach and puts a firm ceiling on how accurate my model can be. Ideally, I'd like to have a function that dynamically and incrementally updates the weights of each observation before the calculation of the mean scores.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文