def _crossProduct( self, ls ):
        """Internal method to generate the cross product of all parameter
        values, creating the parameter space for the experiment.

        :param ls: an array of parameter names
        :returns: list of dicts"""
        p = ls[0]
        ds = []
        if len(ls) == 1:
            # last parameter, convert range to a dict
            for i in self._parameters[p]:
                dp = dict()
                dp[p] = i
                ds.append(dp)
        else:
            # for other parameters, create a dict combining each value in
            # the range to a copy of the dict of other parameters
            ps = self._crossProduct(ls[1:])
            for i in self._parameters[p]:
                for d in ps:
                    dp = d.copy()
                    dp[p] = i
                    ds.append(dp)

        # return the complete parameter space
        return ds
def _crossProduct ( self , ls ) : p = ls [ 0 ] ds = [ ] if len ( ls ) == 1 : for i in self . _parameters [ p ] : dp = dict ( ) dp [ p ] = i ds . append ( dp ) else : ps = self . _crossProduct ( ls [ 1 : ] ) for i in self . _parameters [ p ] : for d in ps : dp = d . copy ( ) dp [ p ] = i ds . append ( dp ) return ds
Internal method to generate the cross product of all parameter
        values, creating the parameter space for the experiment.

        :param ls: an array of parameter names
        :returns: list of dicts