class_docstr: Tool for running many experiments given hyperparameter ranges.
class_docstr_tok: ["Tool","for","running","many","experiments","given","hyperparameter","ranges","."]
docstr: Given a variant (dict of valid param/value pairs), make an exp_name.
  
  A variant's name is constructed as the grid name (if you've given it 
  one), plus param names (or shorthands if available) and values 
  separated by underscores.
  
  Note: if ``seed`` is a parameter, it is not included in the name.
docstr_tok: ["Given","a","variant","(","dict","of","valid","param\/value","pairs",")",",","make","an","exp_name",".","A","variant","'s","name","is","constructed","as","the","grid","name","(","if","you","'ve","given","it","one",")",",","plus","param","names","(","or","shorthands","if","available",")","and","values","separated","by","underscores",".","Note",":","if","``","seed","``","is","a","parameter",",","it","is","not","included","in","the","name","."]
code: def variant_name(self, variant):
      """
      Given a variant (dict of valid param/value pairs), make an exp_name.
  
      A variant's name is constructed as the grid name (if you've given it
      one), plus param names (or shorthands if available) and values
      separated by underscores.
  
      Note: if ``seed`` is a parameter, it is not included in the name.
      """
  
      def get_val(v, k):
          # Utility method for getting the correct value out of a variant
          # given as a nested dict. Assumes that a parameter name, k,
          # describes a path into the nested dict, such that k='a:b:c'
          # corresponds to value=variant['a']['b']['c']. Uses recursion
          # to get this.
          if k in v:
              return v[k]
          else:
              splits = k.split(":")
              k0, k1 = splits[0], ":".join(splits[1:])
              return get_val(v[k0], k1)
  
      # Start the name off with the name of the variant generator.
      var_name = self._name
  
      # Build the rest of the name by looping through all parameters,
      # and deciding which ones need to go in there.
      for k, v, sh, inn in zip(
          self.keys, self.vals, self.shs, self.in_names
      ):
          # Include a parameter in a name if either 1) it can take multiple
          # values, or 2) the user specified that it must appear in the name.
          # Except, however, when the parameter is 'seed'. Seed is handled
          # differently so that runs of the same experiment, with different
          # seeds, will be grouped by experiment name.
          if (len(v) > 1 or inn) and not (k == "seed"):
              # Use the shorthand if available, otherwise the full name.
              param_name = sh if sh is not None else k
              param_name = valid_str(param_name)
  
              # Get variant value for parameter k
              variant_val = get_val(variant, k)
  
              # Append to name
              if all_bools(v):
                  # If this is a param which only takes boolean values,
                  # only include in the name if it's True for this variant.
                  var_name += ("_" + param_name) if variant_val else ""
              else:
                  var_name += "_" + param_name + valid_str(variant_val)
  
      return var_name.lstrip("_")
  
imports: from spinup.user_config import DEFAULT_DATA_DIR, FORCE_DATESTAMP, DEFAULT_SHORTHAND, WAIT_BEFORE_LAUNCH
  from spinup.utils.logx import colorize
  from spinup.utils.mpi_tools import mpi_fork, msg
  from spinup.utils.serialization_utils import convert_json
  import base64
  from copy import deepcopy
  import cloudpickle
  import json
  import numpy
  import os
  import os.path
  import psutil
  import string
  import subprocess
  from subprocess import CalledProcessError
  import sys
  from textwrap import dedent
  import time
  from tqdm import trange
  import zlib
label_desc: Use image node_id 6 for calling the ExperimentGrid obj's underlying member method code with example usage: obj.variant_name(variant) and returns: var_name, v, get_val