【发布时间】:2019-12-27 01:34:40
【问题描述】:
我正在构建一种算法,以使用之前比赛的表现来预测体育赛事的结果。例如,我可能有两个如下所示的列表:
# list of game numbers
game_number = [1, 2, 3, 4, 5, 6, 7]
# list of points scored
points_scored = [100, 106, 99, 106, 89, 94, 113]
我可以使用以下方法轻松计算平均值:
# calculate mean
mean_points_scored = np.mean(points_scored)
但是,我希望在计算平均值时对最近的游戏进行更重的加权。有人有这方面的经验吗?
【问题讨论】:
标签: python numpy weighted-average