1107. Social Clusters (30)-PAT甲级真题

When register on a social network, you are always asked to specify your hobbies in order to find some potential friends with the same hobbies. A "social cluster" is a set of people who have some of their hobbies in common. You are supposed to find all the clusters.

Input Specification:

Each input file contains one test case. For each test case, the first line contains a positive integer N (<=1000), the total number of people in a social network. Hence the people are numbered from 1 to N. Then N lines follow, each gives the hobby list of a person in the format:
Ki: hi[1] hi[2] ... hi[Ki]
where Ki (>0) is the number of hobbies, and hi[j] is the index of the j-th hobby, which is an integer in [1, 1000].</

zyq@zyqdeMBP 赚钱 % /usr/local/bin/python3 /Users/zyq/Documents/admin/赚钱/分类.py 2025-08-13 20:38:31,454 - INFO - 开始读取文件... 2025-08-13 20:38:31,634 - INFO - 找到 35916 个字符串 2025-08-13 20:38:31,661 - INFO - 去重后剩余 34066 个唯一字符串 2025-08-13 20:38:31,661 - INFO - 开始聚类处理... 2025-08-13 20:38:31,661 - INFO - 处理批次 1/7,包含 5000 个字符串 2025-08-13 20:38:42,323 - INFO - 处理批次 2/7,包含 5000 个字符串 2025-08-13 20:38:53,049 - INFO - 处理批次 3/7,包含 5000 个字符串 2025-08-13 20:39:03,969 - INFO - 处理批次 4/7,包含 5000 个字符串 2025-08-13 20:39:14,933 - INFO - 处理批次 5/7,包含 5000 个字符串 2025-08-13 20:39:25,947 - INFO - 处理批次 6/7,包含 5000 个字符串 2025-08-13 20:39:36,326 - INFO - 处理批次 7/7,包含 4066 个字符串 2025-08-13 20:39:44,948 - INFO - 开始合并 135 个聚类 2025-08-13 20:39:46,291 - INFO - 合并后剩余 34 个聚类 2025-08-13 20:39:46,291 - INFO - 第一次聚类完成,耗时: 74.63秒 2025-08-13 20:39:46,291 - INFO - 高效验证第一次聚类结果... 2025-08-13 20:39:46,291 - INFO - 开始高效验证 34 个聚类... 2025-08-13 20:39:46,291 - INFO - 验证进度: 0/34 2025-08-13 20:39:46,323 - INFO - 对匹配率低于 0.99 的聚类进行二次聚类... 2025-08-13 20:39:46,323 - INFO - 开始对低质量聚类进行二次聚类... Traceback (most recent call last): File "/Users/zyq/Documents/admin/赚钱/分类.py", line 281, in <module> new_clusters = recluster_low_quality_clusters(merged_clusters, first_validation, threshold=0.99) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/zyq/Documents/admin/赚钱/分类.py", line 181, in recluster_low_quality_clusters if data['match_rate'] < threshold and len(data['strings']) > 1 ~~~~^^^^^^^^^^^ KeyError: 'strings'. 如果我设置匹配率低于0.99 导致我平铺的结果有问题
最新发布
08-14
评论 7
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值