Entity Match Categorizer

class cognite.utils.contextualization.EntityMatchCategorizer(client: CogniteClient)

Although entity matching in SDK offers greater flexibility, its utility is constrained by the lack of an easy way to group matches by pattern. EntityMatchCategorizer helps to reproduce the “group by pattern” feature in UI, making SDK-based entity matching more effective.

Parameters

client (CogniteClient) – A client object connecting to CDF project of concern.

group_matches_by_pattern(match_result: dict, pattern_fields: Tuple[str]) None

Organize the given entity matching result into pattern-based subgroups.

Parameters
  • match_result (dict) – A dictionary object returned from an entity matching (prediction) job.

  • pattern_fields (Tuple[str]) – A field name pair (source vs. target) to derive patterns from.

to_pandas() DataFrame

Present matches by pattern in a tabular form.

Returns

A table containing match information by pattern.

Return type

(pandas.DataFrame)

inspect_pattern(i_pattern: int, j_example: int, compare_fields: List[Tuple[str]]) None

Inspect the given match pattern and its example case.

Parameters
  • i_pattern (int) – Index of the inquired match pattern.

  • j_example (int) – Index of the match case within the inquired match pattern.

  • compare_fields (List[str]) – List of field name pairs to compare between source vs. target.

save_patterns_to_cdf(pattern_index_list: List[int]) None

Save matches from selected patterns into CDF.

Parameters

pattern_index_list (List[int]) – List of indices of the selected pattern groups.