kedro
建议将参数存储在conf/base/parameters.yml
. 让我们假设它看起来像这样:
step_size: 1
model_params:
learning_rate: 0.01
test_data_ratio: 0.2
num_train_steps: 10000
现在想象一下,我有一些data_engineering
管道,其nodes.py
功能如下所示:
def some_pipeline_step(num_train_steps):
"""
Takes the parameter `num_train_steps` as argument.
"""
pass
我将如何着手并将嵌套参数直接传递给这个函数data_engineering/pipeline.py
?我尝试失败:
from kedro.pipeline import Pipeline, node
from .nodes import split_data
def create_pipeline(**kwargs):
return Pipeline(
[
node(
some_pipeline_step,
["params:model_params.num_train_steps"],
dict(
train_x="train_x",
train_y="train_y",
),
)
]
)
我知道我可以通过使用将所有参数传递给函数,['parameters']
或者只是传递所有model_params
参数,['params:model_params']
但这似乎不优雅,我觉得必须有一种方法。将不胜感激任何输入!