tfma.utils.get_by_keys
Stay organized with collections
Save and categorize content based on your preferences.
Returns value with given key(s) in (possibly multi-level) dict.
tfma.utils.get_by_keys(
data: Mapping[str, Any],
keys: Sequence[Any],
default_value=None,
optional: bool = False
) -> Any
The keys represent multiple levels of indirection into the data. For example
if 3 keys are passed then the data is expected to be a dict of dict of dict.
For compatibily with data that uses prefixing to create separate the keys in a
single dict, lookups will also be searched for under the keys separated by
'/'. For example, the keys 'head1' and 'probabilities' could be stored in a
a single dict as 'head1/probabilties'.
Args |
data
|
Dict to get value from.
|
keys
|
Sequence of keys to lookup in data. None keys will be ignored.
|
default_value
|
Default value if not found.
|
optional
|
Whether the key is optional or not. If default value is None and
optional is False then a ValueError will be raised if key not found.
|
Raises |
ValueError
|
If (non-optional) key is not found.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-04-26 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-04-26 UTC."],[],[]]