Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing default separator for flattening params don't work if dictionnary has depth >1 #230

Closed
Galileo-Galilei opened this issue Aug 20, 2021 · 0 comments · Fixed by #225
Assignees
Labels
bug Something isn't working

Comments

@Galileo-Galilei
Copy link
Owner

Description

Changing the default hooks.nodes.sep `separator in the mlflow.yml does only work when the flattened dictionnary has depth one.

Context

How has this bug affected you? What were you trying to accomplish?

I was trying to change the default separator when flattening dict parameters.

Steps to Reproduce

  1. Create a kedro project
  2. Create mlflow.yml with kedro mlflow init
  3. Change the default config:
# conf/local/mlflow.yml

hooks:
  node:
    flatten_dict_params: True  # Changed, default is True
    recursive: True  
    sep: "_" # Changed, default is "."
    long_parameters_strategy: fail 
# conf/base/parameters.yml

nested_params:
  a: 1
  b: 
    b1: 1
    b2: 2
  1. Use this parameter in a node
  2. Launch kedro run

Actual Result vs expected

The following parameters are then logged in mlflow:
-nested_params_a = 1
-nested_params_b.b1 = 1 (expected result is nested_params_b_b1 = 1)
-nested_params_b.b2 = 2 (expected result is nested_params_b_b2 = 1)

Solution:

The faulty line is

new_value = flatten_dict(value) if recursive else value

Because arguments are not passed to the recursive call to flatten_dict

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: ✅ Done
1 participant