How to use the mlblocks.mlblock.MLBlock._get_tunable function in mlblocks

To help you get started, we’ve selected a few mlblocks examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github HDI-Project / MLBlocks / tests / test_mlblock.py View on Github external
# setup
        init_params = {
            'an_init_param': 'a_value'
        }
        hyperparameters = {
            'tunable': {
                'this_is_not_conditional': {
                    'type': 'int',
                    'default': 1,
                    'range': [1, 10]
                }
            }
        }

        # run
        tunable = MLBlock._get_tunable(hyperparameters, init_params)

        # assert
        expected = {
            'this_is_not_conditional': {
                'type': 'int',
                'default': 1,
                'range': [1, 10]
            }
        }
        assert tunable == expected
github HDI-Project / MLBlocks / tests / test_mlblock.py View on Github external
'type': 'str',
                            'default': 'a',
                            'values': ['a', 'b']
                        },
                        'neither_a_match': {
                            'type': 'int',
                            'default': 0,
                            'range': [1, 10]
                        }
                    }
                }
            }
        }

        # run
        tunable = MLBlock._get_tunable(hyperparameters, init_params)

        # assert
        expected = {
            'this_is_not_conditional': {
                'type': 'int',
                'default': 1,
                'range': [1, 10]
            },
            'this_is_conditional': {
                'type': 'float',
                'default': 0.1,
                'values': [0, 1]
            }
        }
        assert tunable == expected
github HDI-Project / MLBlocks / tests / test_mlblock.py View on Github external
'type': 'str',
                            'default': 'a',
                            'values': ['a', 'b']
                        },
                        'a_match': {
                            'type': 'int',
                            'default': 0,
                            'range': [1, 10]
                        }
                    }
                }
            }
        }

        # run
        tunable = MLBlock._get_tunable(hyperparameters, init_params)

        # assert
        expected = {
            'this_is_not_conditional': {
                'type': 'int',
                'default': 1,
                'range': [1, 10]
            },
            'this_is_conditional': {
                'type': 'int',
                'default': 0,
                'range': [1, 10]
            }
        }
        assert tunable == expected
github HDI-Project / MLBlocks / tests / test_mlblock.py View on Github external
'values': [0, 1]
                    },
                    'values': {
                        'not_a_match': {
                            'type': 'str',
                            'default': 'a',
                            'values': ['a', 'b']
                        },
                        'a_match': None
                    }
                }
            }
        }

        # run
        tunable = MLBlock._get_tunable(hyperparameters, init_params)

        # assert
        expected = {
            'this_is_not_conditional': {
                'type': 'int',
                'default': 1,
                'range': [1, 10]
            }
        }
        assert tunable == expected
github HDI-Project / MLBlocks / tests / test_mlblock.py View on Github external
'type': 'str',
                            'default': 'a',
                            'values': ['a', 'b']
                        },
                        'neither_a_match': {
                            'type': 'int',
                            'default': 0,
                            'range': [1, 10]
                        }
                    }
                }
            }
        }

        # run
        tunable = MLBlock._get_tunable(hyperparameters, init_params)

        # assert
        expected = {
            'this_is_not_conditional': {
                'type': 'int',
                'default': 1,
                'range': [1, 10]
            },
            'this_is_conditional': {
                'type': 'float',
                'default': 0.1,
                'values': [0, 1]
            }
        }
        assert tunable == expected
github HDI-Project / MLBlocks / tests / test_mlblock.py View on Github external
'type': 'str',
                            'default': 'a',
                            'values': ['a', 'b']
                        },
                        'neither_a_match': {
                            'type': 'int',
                            'default': 0,
                            'range': [1, 10]
                        }
                    }
                }
            }
        }

        # run
        tunable = MLBlock._get_tunable(hyperparameters, init_params)

        # assert
        expected = {
            'this_is_not_conditional': {
                'type': 'int',
                'default': 1,
                'range': [1, 10]
            }
        }
        assert tunable == expected