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

Before Change


         NOTE: The upper and lower bounds are inclusive for `Integer`
         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:

After Change


    
    space = Space(dimensions)
    transformed_dimensions = []
    if space.is_categorical:
        // recreate the space and explicitly set transform to "identity"
        // this is a special case for GP based regressors
        for dimension in space:
            transformed_dimensions.append(Categorical(dimension.categories,
                                                      dimension.prior,
                                                      transform="identity"))

    else:
        for dimension in space.dimensions:
            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: 12

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: ContextLab/hypertools
Commit Name: 3e5f0e03cec31629d2a8db78751d80019aa629ce
Time: 2017-05-31
Author: andrew.heusser@gmail.com
File Name: hypertools/plot/plot.py
Class Name:
Method Name: plot


Project Name: ContextLab/hypertools
Commit Name: 57341c920b62c30155a2dd36aa4ae6dd338a76c9
Time: 2017-05-31
Author: andrew.heusser@gmail.com
File Name: hypertools/plot/plot.py
Class Name:
Method Name: plot


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