Adds a new experiment
542450
def add_experiment(experiment):
    """"""
    redis = oz.redis.create_connection()
    oz.bandit.add_experiment(redis, experiment)
25307
def _generate_trials(self, experiment_spec, output_path=""):
        
        if "run" not in experiment_spec:
            raise TuneError("Must specify `run` in {}".format(experiment_spec))
        for _ in range(experiment_spec.get("num_samples", 1)):
            trial_id = Trial.generate_id()
            while True:
                suggested_config = self._suggest(trial_id)
                if suggested_config is None:
                    yield None
                else:
                    break
            spec = copy.deepcopy(experiment_spec)
            spec["config"] = merge_dicts(spec["config"], suggested_config)
            flattened_config = resolve_nested_dict(spec["config"])
            self._counter += 1
            tag = "{0}_{1}".format(
                str(self._counter), format_vars(flattened_config))
            yield create_trial_from_spec(
                spec,
                output_path,
                self._parser,
                experiment_tag=tag,
                trial_id=trial_id)
1328690
def addinstance(self, testfile, features, classlabel="?"):
        """"""

        features = self.validatefeatures(features)

        if self.delimiter in classlabel:
            raise ValueError("Class label contains delimiter: " + self.delimiter)


        f = io.open(testfile,'a', encoding=self.encoding)
        f.write(self.delimiter.join(features) + self.delimiter + classlabel + "\n")
        f.close()
490763
def add_samples(self, samples: Iterable[Sample]) -> None:
        """"""
        for sample in samples:
            self.add_sample(sample)
690597
def validate_experimental(context, param, value):
    """"""
    if value is None:
        return
    config = ExperimentConfiguration(value)
    config.validate()
    return config
57229
def create_experiment(args):
    ''''''
    config_file_name = ''.join(random.sample(string.ascii_letters + string.digits, 8))
    nni_config = Config(config_file_name)
    config_path = os.path.abspath(args.config)
    if not os.path.exists(config_path):
        print_error('Please set correct config path!')
        exit(1)
    experiment_config = get_yml_content(config_path)
    validate_all_content(experiment_config, config_path)

    nni_config.set_config('experimentConfig', experiment_config)
    launch_experiment(args, experiment_config, 'new', config_file_name)
    nni_config.set_config('restServerPort', args.port)
283471
def add_experiment(redis, name):
    """"""

    if not ALLOWED_NAMES.match(name):
        raise ExperimentException(name, "Illegal name")
    if redis.exists(EXPERIMENT_REDIS_KEY_TEMPLATE % name):
        raise ExperimentException(name, "Already exists")

    json = dict(creation_date=util.unicode_type(datetime.datetime.now()))
    pipe = redis.pipeline(transaction=True)
    pipe.sadd(ACTIVE_EXPERIMENTS_REDIS_KEY, name)
    pipe.hset(EXPERIMENT_REDIS_KEY_TEMPLATE % name, "metadata", escape.json_encode(json))
    pipe.execute()
    return Experiment(redis, name)
484658
def create_experiment_summary():
  """"""

  # Convert TEMPERATURE_LIST to google.protobuf.ListValue
  temperature_list = struct_pb2.ListValue()
  temperature_list.extend(TEMPERATURE_LIST)
  materials = struct_pb2.ListValue()
  materials.extend(HEAT_COEFFICIENTS.keys())
  return summary.experiment_pb(
      hparam_infos=[
          api_pb2.HParamInfo(name='initial_temperature',
                             display_name='Initial temperature',
                             type=api_pb2.DATA_TYPE_FLOAT64,
                             domain_discrete=temperature_list),
          api_pb2.HParamInfo(name='ambient_temperature',
                             display_name='Ambient temperature',
                             type=api_pb2.DATA_TYPE_FLOAT64,
                             domain_discrete=temperature_list),
          api_pb2.HParamInfo(name='material',
                             display_name='Material',
                             type=api_pb2.DATA_TYPE_STRING,
                             domain_discrete=materials)
      ],
      metric_infos=[
          api_pb2.MetricInfo(
              name=api_pb2.MetricName(
                  tag='temperature/current/scalar_summary'),
              display_name='Current Temp.'),
          api_pb2.MetricInfo(
              name=api_pb2.MetricName(
                  tag='temperature/difference_to_ambient/scalar_summary'),
              display_name='Difference To Ambient Temp.'),
          api_pb2.MetricInfo(
              name=api_pb2.MetricName(
                  tag='delta/scalar_summary'),
              display_name='Delta T')
      ]
  )
907928
def make_experiment_tag(orig_tag, config, mutations):
    """"""

    resolved_vars = {}
    for k in mutations.keys():
        resolved_vars[("config", k)] = config[k]
    return "{}@perturbed[{}]".format(orig_tag, format_vars(resolved_vars))
127498
def add_play(self, choice, count=1):
        """"""
        self.redis.hincrby(EXPERIMENT_REDIS_KEY_TEMPLATE % self.name, "%s:plays" % choice, count)
        self._choices = None
1373851
def assign(self, experiment):
        """"""

        self.experiments.append(experiment)
        self.farms.append(empty_farm)
736554
def update_iteration(self):
        """"""
        iteration_config = self.get_iteration_config()
        if not iteration_config:
            return
        experiments_metrics = self.experiment_group.get_experiments_metrics(
            experiment_ids=iteration_config.experiment_ids,
            metric=self.get_metric_name()
        )
        experiments_configs = self.experiment_group.get_experiments_declarations(
            experiment_ids=iteration_config.experiment_ids
        )
        iteration_config.experiments_configs = list(experiments_configs)
        iteration_config.experiments_metrics = [m for m in experiments_metrics if m[1] is not None]
        self._update_config(iteration_config)
1374335
def add_sample(self, ts, **kwargs):
        """"""
        if not self.series.offsets:
            self.ts = ts
            offset = 0
        else:
            dt = ts - self.ts
            offset = (dt.days * 24 * 60 * 60 * 1000 + dt.seconds * 1000 +
                      dt.microseconds // 1000)
        self.series.add_sample(offset, **kwargs)
500903
def create_iteration(self, num_suggestions):
        """"""
        from db.models.experiment_groups import ExperimentGroupIteration

        iteration_config = self.experiment_group.iteration_config

        if iteration_config is None:
            iteration = 0
            old_experiment_ids = None
            old_experiments_configs = None
            old_experiments_metrics = None
        else:
            iteration = iteration_config.iteration + 1
            old_experiment_ids = iteration_config.combined_experiment_ids
            old_experiments_configs = iteration_config.combined_experiments_configs
            old_experiments_metrics = iteration_config.combined_experiments_metrics

        # Create a new iteration config
        iteration_config = BOIterationConfig(
            iteration=iteration,
            num_suggestions=num_suggestions,
            old_experiment_ids=old_experiment_ids,
            old_experiments_configs=old_experiments_configs,
            old_experiments_metrics=old_experiments_metrics,
            experiment_ids=[],
            experiments_configs=[],
        )
        return ExperimentGroupIteration.objects.create(
            experiment_group=self.experiment_group,
            data=iteration_config.to_dict())
1089512
def added(self, context):
        """"""
        context.ansi = ANSIFormatter(self._enable)
        context.aprint = context.ansi.aprint
819666
def add_measurement(request, experiment_id):
	""""""
	experiment = get_object_or_404(Experiment, pk=experiment_id)
	if request.method == 'POST':
		form = MeasurementForm(request.POST)
		if form.is_valid():
			form.save()
			return HttpResponseRedirect( experiment.get_absolute_url() ) 
	else:
		form = MeasurementForm() 
	return render(request, "data_entry_form.html", {"form": form, "experiment": experiment })
351479
def update_experiment():
    ''''''
    experiment_config = Experiments()
    experiment_dict = experiment_config.get_all_experiments()
    if not experiment_dict:
        return None
    for key in experiment_dict.keys():
        if isinstance(experiment_dict[key], dict):
            if experiment_dict[key].get('status') != 'STOPPED':
                nni_config = Config(experiment_dict[key]['fileName'])
                rest_pid = nni_config.get_config('restServerPid')
                if not detect_process(rest_pid):
                    experiment_config.update_experiment(key, 'status', 'STOPPED')
                    continue
                rest_port = nni_config.get_config('restServerPort')
                startTime, endTime = get_experiment_time(rest_port)
                if startTime:
                    experiment_config.update_experiment(key, 'startTime', startTime)
                if endTime:
                    experiment_config.update_experiment(key, 'endTime', endTime)
                status = get_experiment_status(rest_port)
                if status:
                    experiment_config.update_experiment(key, 'status', status)