7bd676c9ab6b23ec93499fd72aeadee3a334a163,skopt/utils.py,,normalize_dimensions,#Any#,443

Before Change


         dimensions.
    
    dim_types = [check_dimension(d) for d in dimensions]
    is_cat = all([isinstance(d, Categorical) for d in dim_types])
    if is_cat:
        transformed_dims = [check_dimension(d, transform="identity")
                            for d in dimensions]
    else:
        transformed_dims = []
        for dim_type, dim in zip(dim_types, dimensions):
            if isinstance(dim_type, Categorical):
                transformed_dims.append(
                    check_dimension(dim, transform="onehot")
                    )
            // To make sure that GP operates in the [0, 1] space
            else:
                transformed_dims.append(
                    check_dimension(dim, transform="normalize")
                    )
    return transformed_dims

After Change


            if isinstance(dimension, Categorical):
                transformed_dimensions.append(dimension)
            // To make sure that GP operates in the [0, 1] space
            elif isinstance(dimension, Real):
                transformed_dimensions.append(
                    Real(dimension.low, dimension.high, dimension.prior,
                         transform="normalize")
                    )
            elif isinstance(dimension, Integer):
                transformed_dimensions.append(
                    Integer(dimension.low, dimension.high,
                            transform="normalize")
                    )
            else:
                raise RuntimeError("Unknown dimension type "
                                   "(%s)" % type(dimension))

    return Space(transformed_dimensions)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 8

Instances


Project Name: scikit-optimize/scikit-optimize
Commit Name: 7bd676c9ab6b23ec93499fd72aeadee3a334a163
Time: 2017-08-18
Author: betatim@gmail.com
File Name: skopt/utils.py
Class Name:
Method Name: normalize_dimensions


Project Name: scikit-optimize/scikit-optimize
Commit Name: 7bd676c9ab6b23ec93499fd72aeadee3a334a163
Time: 2017-08-18
Author: betatim@gmail.com
File Name: skopt/utils.py
Class Name:
Method Name: normalize_dimensions


Project Name: arogozhnikov/einops
Commit Name: 680f4831e6c8f3102be8d99056b746b48ce34051
Time: 2018-09-27
Author: iamfullofspam@gmail.com
File Name: einops.py
Class Name:
Method Name: reduce


Project Name: pfnet/optuna
Commit Name: 5abd67cfe591d58c41af5fedeff06bda057c6d55
Time: 2020-11-09
Author: imamura@ms.k.u-tokyo.ac.jp
File Name: optuna/trial/_frozen.py
Class Name: FrozenTrial
Method Name: value