Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Function to flatten hierarchical parameters when training a pandas pipeline
def hierarchical_to_flattened_parameters(parameters_dict):
Flatten an hierarchical dict to an sklearn parameter set.
:param parameters_dict: hierarchical dict
:return: flattened dict
return json_normalize(parameters_dict, sep='__').to_dict(orient='records')[0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment