你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

jaccard_index()

Applies to: ✅ Microsoft FabricAzure Data ExplorerAzure MonitorMicrosoft Sentinel

Calculates the Jaccard index of two input sets.

Syntax

jaccard_index(set1, set2)

Learn more about syntax conventions.

Parameters

Name Type Required Description
set1 dynamic ✔️ The array representing the first set for the calculation.
set2 dynamic ✔️ The array representing the second set for the calculation.

Note

Duplicate values in the input arrays are ignored.

Returns

The Jaccard index of the two input sets. The Jaccard index formula is |set1set2| / |set1set2|.

Examples

print set1=dynamic([1,2,3]), set2=dynamic([1,2,3,4])
| extend jaccard=jaccard_index(set1, set2)

Output

set1 set2 jaccard
[1,2,3] [1,2,3,4] 0.75