5fe98231a26e08d81f9684a681af43bc2fb2b847,pyinterpret/data/dataset.py,DataSet,generate_grid,#DataSet#Any#Any#Any#,60

Before Change


        assert isinstance(grid_resolution, int) and grid_resolution > 0, grid_resolution_warning

        feature_id_warning = "Must pass in feature ids contained in DataSet.feature_ids"
        assert all(feature_id in self.feature_ids for feature_id in feature_ids), feature_id_warning

        grid_range = [x * 100 for x in grid_range]
        bins = np.linspace(*grid_range, num=grid_resolution)
        grid = []

After Change


                                There are as many columns as specified by grid_resolution
        

        if not all(i >= 0 and i <= 1 for i in grid_range):
            err_msg = "Grid range values must be between 0 and 1 but got:" \
                                 "{}".format(grid_range)
            raise exceptions.MalformedGridRangeError(err_msg)

        if not isinstance(grid_resolution, int) and grid_resolution > 0:
            err_msg = "Grid resolution {} is not a positive integer".format(grid_resolution)
            raise exceptions.MalformedGridRangeError(err_msg)

        if not all(feature_id in self.feature_ids for feature_id in feature_ids):
            missing_features = []
            for feature_id in feature_ids:
                if feature_id not in self.feature_ids:
                    missing_features.append(feature_id)
            err_msg = "Feature ids {} not found in DataSet.feature_ids".format(missing_features)
            raise KeyError(err_msg)

        grid_range = [x * 100 for x in grid_range]
        bins = np.linspace(*grid_range, num=grid_resolution)
        grid = []
        for feature_id in feature_ids:
            vals = np.percentile(self[feature_id], bins)
            grid.append(vals)
        grid = np.array(grid)
        self.logger.info("Generated grid of shape {}".format(grid.shape))
        return grid

    def _build_metastore(self, bin_count):
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 5

Instances


Project Name: datascienceinc/Skater
Commit Name: 5fe98231a26e08d81f9684a681af43bc2fb2b847
Time: 2017-03-16
Author: aikramer2@gmail.com
File Name: pyinterpret/data/dataset.py
Class Name: DataSet
Method Name: generate_grid


Project Name: ray-project/ray
Commit Name: 7c0200c93b88898507dbafcb2d92314d0dbcd451
Time: 2020-04-28
Author: ed.nmi.oakes@gmail.com
File Name: python/ray/serve/master.py
Class Name: ServeMaster
Method Name: create_endpoint


Project Name: ray-project/ray
Commit Name: 63594c537064d5cc47179169df6e6e6defa613d6
Time: 2021-03-25
Author: ed.nmi.oakes@gmail.com
File Name: python/ray/serve/backend_state.py
Class Name: BackendState
Method Name: _scale_backend_replicas


Project Name: facebookresearch/Horizon
Commit Name: 155cf7abea98b2e74bf4a66a25900b446207cb82
Time: 2018-01-03
Author: nishadsingh@fb.com
File Name: ml/rl/training/discrete_action_trainer.py
Class Name: DiscreteActionTrainer
Method Name: train