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

Support dynamic inputs and outputs #134

Closed
pvk-developer opened this issue Feb 19, 2021 · 0 comments · Fixed by #135
Closed

Support dynamic inputs and outputs #134

pvk-developer opened this issue Feb 19, 2021 · 0 comments · Fixed by #135
Assignees
Labels
approved The issue is approved and work can be started new feature
Milestone

Comments

@pvk-developer
Copy link
Collaborator

pvk-developer commented Feb 19, 2021

Problem Description

Currently MLPipeline can't reach the primitives inputs or outputs dynamically, which means that it will return the current value that is hold within the json file or the dictionary.

If we can specify a function that returns the expected input or output we will be able to dynamically read those even if they are not specified within the json file (the function should be).

Expected Behavior

  1. The MLBlock,_extract_params should consider that self.fit_args and self.produce_args could be str pointing to a function. This would return empty dictionaries for the fit_params and produce_params.
  2. When calling MLPipeline._get_block_variables if we recieve a str when we get the attributes for variables_attr we would call the block.instance with the returned value as a function using getattr:
if isinstance(variables, str):
    variables = getattr(block.instance, variables)()

Example of primitive with dynamic input and output

{
    "name": "mlblocks.MLPipeline",
    "primitive": "mlblocks.MLPipeline",
    "fit": {
        "method": "fit",
        "args": "get_fit_args"
    },
    "produce": {
        "method": "predict",
        "args": "get_predict_args",
        "output": "get_outputs"
    },
    "hyperparameters": {
        "fixed": {
            "pipeline": {
                "type": "str",
                "default": null
            },
            "primitives": {
                "type": "list",
                "default": []
            },
            "init_params": {
                "type": "dict",
                "default": {}
            },
            "input_names": {
                "type": "dict",
                "default": {}
            },
            "output_names": {
                "type": "dict",
                "default": {}
            }
        }
    }
}
@pvk-developer pvk-developer self-assigned this Feb 19, 2021
@pvk-developer pvk-developer added this to the 0.4.1 milestone Feb 19, 2021
@csala csala added new feature approved The issue is approved and work can be started labels Feb 19, 2021
@csala csala closed this as completed in #135 Mar 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved The issue is approved and work can be started new feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants