1. Learn
  2. /
  3. 课程
  4. /
  5. NumPy 入门

Connected

道练习

跨行广播

在上一组练习中,您使用了 monthly_industry_multipliers 来创建销售预测。回忆一下,monthly_industry_multipliers 如下所示:

array([[0.98, 1.02, 1.  ],
       [1.00, 1.01, 0.97],
       [1.06, 1.03, 0.98],
       [1.08, 1.01, 0.98],
       [1.08, 0.98, 0.98],
       [1.1 , 0.99, 0.99],
       [1.12, 1.01, 1.  ],
       [1.1 , 1.02, 1.  ],
       [1.11, 1.01, 1.01],
       [1.08, 0.99, 0.97],
       [1.09, 1.  , 1.02],
       [1.13, 1.03, 1.02]])

假设您不想把估计做得这么具体。相反,您希望使用 monthly_industry_multipliers 为每个行业找到一个单一的平均乘数。然后用该乘数来预测明年的销售额。

已为您导入 numpy 为 np,并提供了 monthly_sales 和 monthly_industry_multipliers 数组。monthly_sales 的列按顺序对应酒类商店、餐馆和百货商店的销售额。

说明 1 / 共 3 个

undefined XP
    1
    2
    3
  • 计算每个行业的平均销售预测乘数;保存到名为 mean_multipliers 的数组中。