def __getitem__(self, ind):
        """Get the parameters that would be ``ind``th in iteration

        Parameters
        ----------
        ind : int
            The iteration index

        Returns
        -------
        params : dict of string to any
            Equal to list(self)[ind]
        """
        # This is used to make discrete sampling without replacement memory
        # efficient.
        for sub_grid in self.param_grid:
            # XXX: could memoize information used here
            if not sub_grid:
                if ind == 0:
                    return {}
                else:
                    ind -= 1
                    continue

            # Reverse so most frequent cycling parameter comes first
            keys, values_lists = zip(*sorted(sub_grid.items())[::-1])
            sizes = [len(v_list) for v_list in values_lists]
            total = np.product(sizes)

            if ind >= total:
                # Try the next grid
                ind -= total
            else:
                out = {}
                for key, v_list, n in zip(keys, values_lists, sizes):
                    ind, offset = divmod(ind, n)
                    out[key] = v_list[offset]
                return out

        raise IndexError('ParameterGrid index out of range')
def __getitem__ ( self , ind ) : for sub_grid in self . param_grid : if not sub_grid : if ind == 0 : return { } else : ind -= 1 continue keys , values_lists = zip ( * sorted ( sub_grid . items ( ) ) [ : : - 1 ] ) sizes = [ len ( v_list ) for v_list in values_lists ] total = np . product ( sizes ) if ind >= total : ind -= total else : out = { } for key , v_list , n in zip ( keys , values_lists , sizes ) : ind , offset = divmod ( ind , n ) out [ key ] = v_list [ offset ] return out raise IndexError ( 'ParameterGrid index out of range' )
Get the parameters that would be ``ind``th in iteration

        Parameters
        ----------
        ind : int
            The iteration index

        Returns
        -------
        params : dict of string to any
            Equal to list(self)[ind]