def _construct_model_name(parameters):
    """Construct model name from the parameters and return it."""
    def format_precision(number):
        if isinstance(number, float):
            return '{:.5f}'.format(number).rstrip('0')
        else:
            return str(number)

    def format_val(val):
        if isinstance(val, list):
            return '-'.join(format_precision(ele) for ele in val)
        else:
            return format_precision(val)

    parameter_names = list(parameters.keys())
    parameter_names.sort()  # sort by key in order to have consistency in the order of params
    return '_'.join('{}-{}'.format(key, format_val(parameters[key])) for key in parameter_names)