← 返回刚才阅读的位置

知识卡片

普通读书笔记卡 · 6672.c · 生成模型:GPT-6

取最高若干项后仍需反向排序

理解等级:中级

argsort默认按分数升序,[-3:]得到最大的三个位置,但其内部顺序仍由低到高。展示最相关在前需反向处理,并区分相同分数、零分和不足候选;不能把尾部切片直接叫已经降序排列的前几名。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • · 查看原书依据

      >>> idx = dotproducts.argsort()[-3:] #2 >>> idx array([18, 35, 71]) >>> dotproducts[idx] array([0. , 0.2393827 , 0.34058149]) >>> df['answer'][idx] 18 You have a sample of measurements and you want... 35 A 'LogisticRegression' will be less likely to ... 71 Decrease the C value, this increases the regul... #1 Coerces the sparse matrix result into a 1Δ array #2 The .argsort method sorts the index values

    参考来源

    - 位置:《Natural Language Processing in Action, Second Edition》第03章《词频与逆文档频率向量》(来源项目:a19c7933-4eda-4176-aebd-30fe7e1ad292;源文件:extracted/Natural Language Processing in Action, Second Edition/_epub-src/OEBPS/Text/chapter-3.html) - 结论依据:摘录中关于取最高若干项后仍需反向排序的定义、比较或条件支撑卡片;原书表述不严谨的范围已在覆盖记录逐项限定,不把案例结果外推为普遍结论。 - 原始内容:>>> idx = dotproducts.argsort()[-3:] #2 >>> idx array([18, 35, 71]) >>> dotproducts[idx] array([0. , 0.2393827 , 0.34058149]) >>> df['answer'][idx] 18 You have a sample of measurements and you want... 35 A 'LogisticRegression' will be less likely to ... 71 Decrease the C value, this increases the regul... #1 Coerces the sparse matrix result into a 1Δ array #2 The .argsort method sorts the index values