Builds and returns all combinations of parameters specified
        by the param grid.
778062
def build(self):
        
        keys = self._param_grid.keys()
        grid_values = self._param_grid.values()

        def to_key_value_pairs(keys, values):
            return [(key, key.typeConverter(value)) for key, value in zip(keys, values)]

        return [dict(to_key_value_pairs(keys, prod)) for prod in itertools.product(*grid_values)]
201973
public function getGridOptions(): array
    {
        $collection = GridModel::findAll(['order' => 'tl_bs_grid.title']);
        $options    = [];

        if ($collection) {
            foreach ($collection as $model) {
                $parent = sprintf(
                    '%s [ID %s]',
                    $model->getRelated('pid')->name,
                    $model->pid
                );

                $options[$parent][$model->id] = sprintf('%s [ID %s]', $model->title, $model->id);
            }
        }

        return $options;
    }
244080
def get_parameters(self):
        """"""
        d = {}
        for p in self.processors:
            parameter_names = list(p.PARAMETERS.keys())
            parameter_values = [getattr(p, n) for n in parameter_names]
            d.update(dict(zip(parameter_names, parameter_values)))
        return d
313424
def get_all_values_of_all_params(self):
        

        values = collections.OrderedDict([[p, []] for p in
                                          sorted(self.get_params())])

        for result in self.get_results():
            for param in self.get_params():
                values[param] += [result['params'][param]]

        sorted_values = collections.OrderedDict([[k,
                                                 sorted(list(set(values[k])))]
                                                 for k in values.keys()])

        for k in sorted_values.keys():
            if sorted_values[k] == []:
                sorted_values[k] = None

        return sorted_values
393010
def _getParameters(self):
        """"""
        param = self.query._getParameters() 
        outputNames = []
        for outputCol in self.__columns:
            outputNames.append(outputCol)            
        param.update({'colModel' : '"'+', '.join(outputNames)+'"'})        
        return param
855891
private void gridSearch(Grid<MP> grid) {
    Model model = null;
    // Prepare nice model key and override default key by appending model counter
    //String protoModelKey = _hyperSpaceWalker.getParams()._model_id == null
    //                       ? grid._key + "_model_"
    //                       : _hyperSpaceWalker.getParams()._model_id.toString() + H2O.calcNextUniqueModelId("") + "_";
    String protoModelKey = grid._key + "_model_";

    try {
      // Get iterator to traverse hyper space
      HyperSpaceWalker.HyperSpaceIterator<MP> it = _hyperSpaceWalker.iterator();
      // Number of traversed model parameters
      int counter = grid.getModelCount();
      while (it.hasNext(model)) {
        if (_job.stop_requested()) throw new Job.JobCancelledException();  // Handle end-user cancel request
        double max_runtime_secs = it.max_runtime_secs();

        double time_remaining_secs = Double.MAX_VALUE;
        if (max_runtime_secs > 0) {
          time_remaining_secs = it.time_remaining_secs();
          if (time_remaining_secs < 0) {
            Log.info("Grid max_runtime_secs of " + max_runtime_secs + " secs has expired; stopping early.");
            throw new Job.JobCancelledException();
          }
        }

        MP params;
        try {
          // Get parameters for next model
          params = it.nextModelParameters(model);

          // Sequential model building, should never propagate
          // exception up, just mark combination of model parameters as wrong

          // Do we need to limit the model build time?
          if (max_runtime_secs > 0) {
            Log.info("Grid time is limited to: " + max_runtime_secs + " for grid: " + grid._key + ". Remaining time is: " + time_remaining_secs);
            if (params._max_runtime_secs == 0) { // unlimited
              params._max_runtime_secs = time_remaining_secs;
              Log.info("Due to the grid time limit, changing model max runtime to: " + params._max_runtime_secs + " secs.");
            } else {
              double was = params._max_runtime_secs;
              params._max_runtime_secs = Math.min(params._max_runtime_secs, time_remaining_secs);
              Log.info("Due to the grid time limit, changing model max runtime from: " + was + " secs to: " + params._max_runtime_secs + " secs.");
            }
          }

          try {
            ScoringInfo scoringInfo = new ScoringInfo();
            scoringInfo.time_stamp_ms = System.currentTimeMillis();

            //// build the model!
            model = buildModel(params, grid, ++counter, protoModelKey);
            if (model != null) {
              model.fillScoringInfo(scoringInfo);
              grid.setScoringInfos(ScoringInfo.prependScoringInfo(scoringInfo, grid.getScoringInfos()));
              ScoringInfo.sort(grid.getScoringInfos(), _hyperSpaceWalker.search_criteria().stopping_metric()); // Currently AUTO for Cartesian and user-specified for RandomDiscrete
            }
          } catch (RuntimeException e) { // Catch everything
            if (!Job.isCancelledException(e)) {
              StringWriter sw = new StringWriter();
              PrintWriter pw = new PrintWriter(sw);
              e.printStackTrace(pw);
              Log.warn("Grid search: model builder for parameters " + params + " failed! Exception: ", e, sw.toString());
            }
            grid.appendFailedModelParameters(params, e);
          }
        } catch (IllegalArgumentException e) {
          Log.warn("Grid search: construction of model parameters failed! Exception: ", e);
          // Model parameters cannot be constructed for some reason
          it.modelFailed(model);
          Object[] rawParams = it.getCurrentRawParameters();
          grid.appendFailedModelParameters(rawParams, e);
        } finally {
          // Update progress by 1 increment
          _job.update(1);
          // Always update grid in DKV after model building attempt
          grid.update(_job);
        } // finally

        if (model != null && grid.getScoringInfos() != null && // did model build and scoringInfo creation succeed?
            _hyperSpaceWalker.stopEarly(model, grid.getScoringInfos())) {
          Log.info("Convergence detected based on simple moving average of the loss function. Grid building completed.");
          break;
        }
      } // while (it.hasNext(model))
      Log.info("For grid: " + grid._key + " built: " + grid.getModelCount() + " models.");
    } finally {
      grid.unlock(_job);
    }
  }
1125509
def params(self):
        """"""
        comb_sizes = []
        comb_keys = []
        for key,val in self.comb_params.items():
            comb_keys.append(key)
            comb_sizes.append(len(val))
        # length of first values array, since lengths should match for sets of
        # jointly varying parameters
        joint_sizes = [len(next(iter(jlist.values()))) for jlist in self.joint_params]
        all_sizes = comb_sizes + joint_sizes
        total_combinations = reduce(operator.mul, all_sizes, 1)
        for i in range(total_combinations):
            sub = np.unravel_index(i, all_sizes)
            params = {}
            # get the comb_params
            for j in range(len(comb_sizes)):
                key = comb_keys[j]
                val_arr = self.comb_params[key]
                params[key] = val_arr[sub[j]]
            # get the joint_params
            for j in range(len(joint_sizes)):
                subj = j + len(comb_sizes)
                for key,val_arr in self.joint_params[j].items():
                    params[key] = val_arr[sub[subj]]
            # how we have one parameter set, check how many times to repeat it
            num_repeats = self.default_repeats
            for func in self.count_funcs:
                c = func(params)
                if c:
                    num_repeats = c
            for i in range(num_repeats):
                yield params
147832
function getGridOffsets(directions, grid, opt) {

        var step = opt.step;

        util.toArray(opt.directions).forEach(function(direction) {

            direction.gridOffsetX = (direction.offsetX / step) * grid.x;
            direction.gridOffsetY = (direction.offsetY / step) * grid.y;
        });
    }
1257555
def paramnames(co):
    
    flags = co.co_flags
    varnames = co.co_varnames

    argcount, kwonlyargcount = co.co_argcount, co.co_kwonlyargcount
    total = argcount + kwonlyargcount

    args = varnames[:argcount]
    kwonlyargs = varnames[argcount:total]
    varargs, varkwargs = None, None
    if flags & Flag.CO_VARARGS:
        varargs = varnames[total]
        total += 1
    if flags & Flag.CO_VARKEYWORDS:
        varkwargs = varnames[total]

    return args, kwonlyargs, varargs, varkwargs
418611
def _build_parmlist(self, parameters):
        

        args = []
        for key, value in parameters.items():
            if not value is None:
                # We always use the explicit-length keyname format, to reduce the chance
                # of requests failing due to unusual characters in parameter values.

                try:
                    classinfo = unicode
                except NameError:
                    classinfo = str

                if isinstance(value, classinfo):
                    key = '%s[%d]' % (key.upper(), len(value.encode('utf-8')))
                else:
                    key = '%s[%d]' % (key.upper(), len(str(value)))
                args.append('%s=%s' % (key, value))
        args.sort()
        parmlist = '&'.join(args)        
        return parmlist
597388
public void generateGrid() {
        minx = minx - extendGrid;
        maxx = maxx + extendGrid;
        miny = miny - extendGrid;
        maxy = maxy + extendGrid;
        minz = minz - extendGrid;
        maxz = maxz + extendGrid;

        dim[0] = (int) Math.round(Math.abs(maxx - minx) / latticeConstant);
        dim[1] = (int) Math.round(Math.abs(maxy - miny) / latticeConstant);
        dim[2] = (int) Math.round(Math.abs(maxz - minz) / latticeConstant);

        grid = new double[dim[0] + 1][dim[1] + 1][dim[2] + 1];
    }
147260
def params(self):
        
        paramlist = [b.params for b in self.bases if b.params.has_value]

        if len(paramlist) == 0:
            return Parameter()
        else:
            return paramlist if len(paramlist) > 1 else paramlist[0]
992424
def get_grid_mapping_variables(ds):
    '''
    
    '''
    grid_mapping_variables = []
    for ncvar in ds.get_variables_by_attributes(grid_mapping=lambda x: x is not None):
        if ncvar.grid_mapping in ds.variables:
            grid_mapping_variables.append(ncvar.grid_mapping)
    return grid_mapping_variables
1015584
public List<ParameterType<ConstructorType<T>>> getAllParameter()
   {
      List<ParameterType<ConstructorType<T>>> list = new ArrayList<ParameterType<ConstructorType<T>>>();
      List<Node> nodeList = childNode.get("parameter");
      for(Node node: nodeList)
      {
         ParameterType<ConstructorType<T>>  type = new ParameterTypeImpl<ConstructorType<T>>(this, "parameter", childNode, node);
         list.add(type);
      }
      return list;
   }
826944
def parameter_values(self):
        
        for param in self.data.get('parameter_values', []):
            cache = ElementCache(data=self.make_request(href=param))
            name = '{}'.format(cache.type.title()).replace('_', '')
            yield type(name, (SituationParameterValue,), {
                'data': cache})(name=cache.name, type=cache.type, href=param)
1041924
function GENERATE_PARAMS(spec) {
  return _.map(spec, function(paramSpec, paramName) {
    return paramName + ': ' + paramSpec.type;
  }).join(', ');
}
591317
def children_and_parameters(m:nn.Module):
    ""
    children = list(m.children())
    children_p = sum([[id(p) for p in c.parameters()] for c in m.children()],[])
    for p in m.parameters():
        if id(p) not in children_p: children.append(ParameterModule(p))
    return children