Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def build_mlblock_model(self, fixed_hyperparameters, tunable_hyperparameters):
"""Build the model for this primitive block.
Args:
fixed_hyperparameters: The fixed hyperparameters to build
this model with. Should be specified as a dict mapping
fixed hyperparameter names to their corresponding
values.
tunable_hyperparameters: The tunable hyperparameters to
build this model with. Should be specified as a dict
mapping hyperparameter name to MLHyperparam object.
Returns:
The model instance of this primitive block.
"""
block_class = import_object(self.metadata['class'])
model_kwargs = fixed_hyperparameters.copy()
model_kwargs.update({
hp_name: tunable_hyperparameters[hp_name].value
for hp_name in tunable_hyperparameters
})
return block_class(**model_kwargs)