f2cfa5fb8e73229a1757acbcc94bab13099de439,PyPi/utils/spaces.py,MultiDiscrete,get_idx,#MultiDiscrete#Any#,84

Before Change



    def get_idx(self, value):
        idx = list()
        for s, v in enumerate(value):
            idx.append(np.argwhere(
                self.discrete_spaces[s].values == v).ravel()[0])

        return idx

After Change


        if value.ndim == 1:
            idxs = [
                self.discrete_spaces[i]._idxs[v] for i, v in enumerate(value)]
        elif value.ndim == 2:
            idxs = list()
            for v in value:
                idx = [
                    self.discrete_spaces[i]._idxs[v1] for i, v1 in enumerate(v)]
                idxs.append(idx)
        else:
            raise ValueError("Wrong dimension for indices array.")

        return np.array(idxs)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 8

Instances


Project Name: AIRLab-POLIMI/mushroom
Commit Name: f2cfa5fb8e73229a1757acbcc94bab13099de439
Time: 2017-06-05
Author: carlo.deramo@gmail.com
File Name: PyPi/utils/spaces.py
Class Name: MultiDiscrete
Method Name: get_idx


Project Name: jnothman/UpSetPlot
Commit Name: a498f3fe9373f1837ba9e003166056181448b1f7
Time: 2019-02-24
Author: joel.nothman@gmail.com
File Name: upsetplot/plotting.py
Class Name:
Method Name: _process_data


Project Name: deepchem/deepchem
Commit Name: ae54ef4994aace27036707e19d51d217f060c8e7
Time: 2017-08-16
Author: rbharath@stanford.edu
File Name: deepchem/models/tensorgraph/tensor_graph.py
Class Name: TensorGraph
Method Name: predict_on_generator