前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Power Query 反馈

Power Query 反馈

作者头像
冬夜先生
发布2022-09-09 15:59:40
9090
发布2022-09-09 15:59:40
举报
文章被收录于专栏:csicocsicocsico

调整相似性阈值

应用模糊匹配算法的最佳方案是,当列中的所有文本字符串仅包含需要比较的字符串,而不是额外的组件时。 例如,与比较相比,与Apples4ppl3s比比产生更高的相似性分数进行比较ApplesMy favorite fruit, by far, is Apples. I simply love them!

这是因为第二个字符串中的单词 Apples 只是整个文本字符串中产生较低相似性分数的一小部分。

查看以下数据集,该数据集包含调查的响应,该数据集中只有一个问题“你最喜欢的水果是什么?”

水果

蓝 莓

蓝色浆果只是最好的

草莓

草莓 = <3

苹果

'sples

4ppl3s

Bananas

fav 水果是香蕉

Banas

到目前为止,我最喜欢的水果是苹果。 我只是爱他们!

调查提供了一个文本框来输入值,且没有验证。

现在,需要对值进行聚类分析。 为此,请将上一个水果表加载到Power Query,选择该列,然后选择在功能区中的“添加列”菜单中读取群集值的选项。

Cluster values icon inside the Add column menu in the ribbon available after selecting the Fruit column from the table.
Cluster values icon inside the Add column menu in the ribbon available after selecting the Fruit column from the table.

此时将显示“ 群集值 ”对话框,可在其中指定新列的名称。 将此新列命名为 “群集 ”,然后选择“ 确定”。

Cluster values dialog box after selecting the Fruit column. The new column name field has been set to 'Cluster'.
Cluster values dialog box after selecting the Fruit column. The new column name field has been set to 'Cluster'.

默认情况下,Power Query将使用 0.8 (或 80% ) 的相似性阈值,并且上一操作的结果将生成下表,其中包含新的群集列:

Default output after performing the Cluster values operation on the Fruit column with default values.
Default output after performing the Cluster values operation on the Fruit column with default values.

完成聚类分析后,不会为所有行提供预期结果。 行号 2 (2) 仍具有值Blue berries are simply the best,但应将其聚集到Blueberries,与文本字符串Strawberries = <3fav fruit is bananas类似,以及My favorite fruit, by far, is Apples. I simply love them!

你希望确定导致此群集的原因。 为此,可以双击 “聚集值 ”步骤来恢复 “群集值 ”窗口。 在此窗口中,展开读取 模糊群集选项 的文本,并启用读取 显示相似性分数 的选项,如下图所示,然后单击“确定”按钮:

Cluster values window with the fuzzy cluster options displayed and the show similarity scores option selected.
Cluster values window with the fuzzy cluster options displayed and the show similarity scores option selected.

启用 “显示相似性分数 ”选项会将新列引入表,该列显示定义的群集与原始值之间的相似性分数。

Table with new similarity score column with the name Fruit_Cluster_Similarity.
Table with new similarity score column with the name Fruit_Cluster_Similarity.

仔细检查后,可以看到,Power Query在文本字符串Blue berries are simply the best的相似性阈值内找不到任何其他值,Strawberries = <3fav fruit is bananas以及My favorite fruit, by far, is Apples. I simply love them!

可以再次返回到 “群集值 ”对话框,方法是双击 “聚集值 ”步骤并将 相似性阈值 从 0.8 更改为 0.6,如下图所示:

Cluster values dialog box with the fuzzy cluster options displayed, the similarity threshold set at 0.6, and the show similarity scores option selected.
Cluster values dialog box with the fuzzy cluster options displayed, the similarity threshold set at 0.6, and the show similarity scores option selected.

此更改使你更接近要查找的结果,但文本字符串 My favorite fruit, by far, is Apples. I simply love them!除外。 这是因为通过将相似性阈值从 0.8 更改为 0.6 Power Query现在能够使用从 0.6 开始到 1 的相似性分数的值。

Table after defining the similarity threshold at 0.6 with new values assigned in the Cluster column.
Table after defining the similarity threshold at 0.6 with new values assigned in the Cluster column.

本文系转载,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文系转载前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 调整相似性阈值
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档