使用多指标筛选来交叉推广图书
最后,电子书初创公司的创始人希望您做进一步筛选。您之前的尝试返回了 82 条规则,但她只想要 1 条。rules 数据集已再次在控制台中提供。最后,Zhang 指标已为您计算好,并作为 zhang 列包含在 rules DataFrame 中。
本练习是课程的一部分
Python 中的购物篮分析
练习说明
- 将提升度阈值设置为大于 1.5。
- 使用 1.0 的确信度阈值。
- 要求 Zhang 指标大于 0.65。
交互式实操练习
通过完成这段示例代码来试试这个练习。
# Set the lift threshold to 1.5
rules = rules[rules['____'] > ____]
# Set the conviction threshold to 1.0
rules = rules[____]
# Set the threshold for Zhang's rule to 0.65
rules = ____
# Print rule
print(rules[['antecedents','consequents']])