Nested parameters update via command line / config file
See original GitHub issueDescription
Currently, when passing a parameter to override configurations like
kedro run --params key:value, it only supports top-level key but not nested dictionary. This is not flexible for experiments.
Similarly, kedro run --config=config.yml, overwriting via config file suffers from the same top-level key only problem.
Ideally.
# paramters.yml
group1:
key1: 1
key2: 2
key3: 3
Ideally, this should be the expected result
# paramters.yml
group1:
key1: 1
key2: 2
key3: 4
Current behavior
# paramters.yml
group1:
key3: 4
Related #605
Context
A lot of parameters are organized in groups instead of being a top-level key.
Possible Implementation
Maybe a simple nest dict update is enough, I am not sure
Possible Alternatives
(Optional) Describe any alternative solutions or features you’ve considered.
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (9 by maintainers)
Top Results From Across the Web
Nested params defined in config are not overridden ... - GitHub
Nested params can be assigned at the command line, but they do not overwrite the params defined in config or script file.
Read more >Forget command-line arguments: use a config file | Medium
In this article, I'll show you ready-to-go examples of how moving your hyper-parameter selections, command-line arguments, and default options ...
Read more >Override nested parameters using kedro run CLI command
I add to my Kedro project file run.py and override KedroContext and ConfigLoader . Now I can use in CLI something like that...
Read more >Lesson 1.3: Nested Commands - DarthPedro's Blog
In these settings, we specify all of the data needed to create a Student as command line arguments. We use a new setting...
Read more >Configure Experiments with wandb.config - Documentation
This is convenient for quickly testing different hyperparameter values from the command line.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Hello @noklam, I totally understand the need for this and agree that there should be a better mechanism for overwriting a nested parameter. But I’m not sure how easy it is to resolve just this without some more holistic solution that reworks how configuration is handled more generally, and as per @lorenabalan’s comment in #605 there’s a bit of a conversation ongoing about this (N.B. @datajoely).
If we allow
kedro run --params key.subkey:valueto overwrite a nested parameter then it immediately raises the question of why we don’t allow this sort of nested overwrite in configuration environments as you wanted to do in #605. So while it sounds like a very useful feature to add, it leads to inconsistency between the CLI and the parameters.yml approaches to specifying configuration. In an ideal world you would be able to do this sort of thing from both CLI and parameters.yml, but that is part of the larger conversation I think (and in addition to overwriting keys should also consider things like deleting and adding keys).This nested overwriting behaviour is already possible through use of
TemplatedConfigLoaderand globals. I know that’s a bit hacky and not a nice solution, but at least it is possible to currently do this. So my opinion would tend to be: very nice idea, I 100% agree we need a better solution than we currently have, but I think it needs to come as part of the complete solution rather than just implementing part of it that only works using the CLI.#927 is an equivalent PR that get merged