Evaluates the model on the validation data and updates the validation metric(s).
544293
def _evaluate(self, val_iter: data_io.BaseParallelSampleIter, val_metric: mx.metric.EvalMetric):
        
        val_iter.reset()
        val_metric.reset()
        self.model.evaluate(val_iter, val_metric)
28403
def calculate_metrics(self, model, train_loader, valid_loader, metrics_dict):
        """"""
        # Check whether or not it's time for validation as well
        self.log_count += 1
        log_valid = (
            valid_loader is not None
            and self.valid_every_X
            and not (self.log_count % self.valid_every_X)
        )

        metrics_dict = {}

        # Calculate custom metrics
        if self.config["log_train_metrics_func"] is not None:
            func = self.config["log_train_metrics_func"]
            func_list = func if isinstance(func, list) else [func]
            for func in func_list:
                metrics_dict = self._calculate_custom_metrics(
                    model, train_loader, func, metrics_dict, split="train"
                )
        if self.config["log_valid_metrics_func"] is not None and log_valid:
            func = self.config["log_valid_metrics_func"]
            func_list = func if isinstance(func, list) else [func]
            for func in func_list:
                metrics_dict = self._calculate_custom_metrics(
                    model, valid_loader, func, metrics_dict, split="valid"
                )

        # Calculate standard metrics
        metrics_dict = self._calculate_standard_metrics(
            model, train_loader, self.log_train_metrics, metrics_dict, "train"
        )

        if log_valid:
            metrics_dict = self._calculate_standard_metrics(
                model, valid_loader, self.log_valid_metrics, metrics_dict, "valid"
            )

        return metrics_dict
980198
def update_validators():
    
    validators.update({
        'fragilityFunction.id': valid.utf8,  # taxonomy
        'vulnerabilityFunction.id': valid.utf8,  # taxonomy
        'consequenceFunction.id': valid.utf8,  # taxonomy
        'asset.id': valid.asset_id,
        'costType.name': valid.cost_type,
        'costType.type': valid.cost_type_type,
        'cost.type': valid.cost_type,
        'area.type': valid.name,
        'isAbsolute': valid.boolean,
        'insuranceLimit': valid.positivefloat,
        'deductible': valid.positivefloat,
        'occupants': valid.positivefloat,
        'value': valid.positivefloat,
        'retrofitted': valid.positivefloat,
        'number': valid.compose(valid.positivefloat, valid.nonzero),
        'vulnerabilitySetID': str,  # any ASCII string is fine
        'vulnerabilityFunctionID': str,  # any ASCII string is fine
        'lossCategory': valid.utf8,  # a description field
        'lr': valid.probability,
        'lossRatio': valid.positivefloats,
        'coefficientsVariation': valid.positivefloats,
        'probabilisticDistribution': valid.Choice('LN', 'BT'),
        'dist': valid.Choice('LN', 'BT', 'PM'),
        'meanLRs': valid.positivefloats,
        'covLRs': valid.positivefloats,
        'format': valid.ChoiceCI('discrete', 'continuous'),
        'mean': valid.positivefloat,
        'stddev': valid.positivefloat,
        'minIML': valid.positivefloat,
        'maxIML': valid.positivefloat,
        'limitStates': valid.namelist,
        'noDamageLimit': valid.NoneOr(valid.positivefloat),
        'loss_type': valid_loss_types,
        'losses': valid.positivefloats,
        'averageLoss': valid.positivefloat,
        'stdDevLoss': valid.positivefloat,
        'ffs.type': valid.ChoiceCI('lognormal'),
        'assetLifeExpectancy': valid.positivefloat,
        'interestRate': valid.positivefloat,
        'lossType': valid_loss_types,
        'aalOrig': valid.positivefloat,
        'aalRetr': valid.positivefloat,
        'ratio': valid.positivefloat,
        'cf': asset_mean_stddev,
        'damage': damage_triple,
        'damageStates': valid.namelist,
        'taxonomy': taxonomy,
        'tagNames': valid.namelist,
    })
289612
void updateModel() {
        for (int i = 0; i < expressions.size(); ++i) {
            String expr = expressions.get(i);
            String result = "";
            if (expr.length() > 0) {
                result = debugGui.dim.eval(expr);
                if (result == null) result = "";
            } else {
                result = "";
            }
            result = result.replace('\n', ' ');
            values.set(i, result);
        }
        fireTableDataChanged();
    }
694382
def validate(self, model, data_access=None, *, fail_fast=None):
    
    if fail_fast is None:
      fail_fast = self.fail_fast

    self.model = model
    self.data_access = data_access
    is_valid = True
    for validation in self.validations:
      if not validation.validate(model, self):
        is_valid = False
        if fail_fast:
          break
    return is_valid
783130
def run_validators(new_data, old_data):
    
    #{'validator_name': (success, score, message)}
    validation_data = {}
    for file_type, lint_data in list(new_data.items()):
        #TODO: What to do if old data doesn't have this filetype?
        old_lint_data = old_data.get(file_type, {})
        validator = ValidatorFactory.get_validator(file_type)
        if validator is not None:
            validation_data[validator.name] = validator.run(lint_data, old_lint_data)
    return validation_data
1133498
def update_metric(self, metric, labels, pre_sliced=False):
        """"""
        self.curr_execgrp.update_metric(metric, labels, pre_sliced)
118543
def validate(model:nn.Module, dl:DataLoader, loss_func:OptLossFunc=None, cb_handler:Optional[CallbackHandler]=None,
             pbar:Optional[PBar]=None, average=True, n_batch:Optional[int]=None)->Iterator[Tuple[Union[Tensor,int],...]]:
    ""
    model.eval()
    with torch.no_grad():
        val_losses,nums = [],[]
        if cb_handler: cb_handler.set_dl(dl)
        for xb,yb in progress_bar(dl, parent=pbar, leave=(pbar is not None)):
            if cb_handler: xb, yb = cb_handler.on_batch_begin(xb, yb, train=False)
            val_loss = loss_batch(model, xb, yb, loss_func, cb_handler=cb_handler)
            val_losses.append(val_loss)
            if not is_listy(yb): yb = [yb]
            nums.append(yb[0].shape[0])
            if cb_handler and cb_handler.on_batch_end(val_losses[-1]): break
            if n_batch and (len(nums)>=n_batch): break
        nums = np.array(nums, dtype=np.float32)
        if average: return (to_np(torch.stack(val_losses)) * nums).sum() / nums.sum()
        else:       return val_losses
1270464
public void validate() {

		ErrorDetails details = null;
		if( this.fileName != null )
			details = ErrorDetails.file( this.fileName );

		if( this.failed ) {
			this.errors.add( new ModelError( ErrorCode.REC_TARGET_INVALID_FILE_OR_CONTENT, this.modelObject, details ));

		} else {
			String id = this.props.getProperty( Constants.TARGET_PROPERTY_ID );
			if( Utils.isEmptyOrWhitespaces( id ))
				this.errors.add( new ModelError( ErrorCode.REC_TARGET_NO_ID, this.modelObject, details ));

			String handler = this.props.getProperty( Constants.TARGET_PROPERTY_HANDLER );
			if( Utils.isEmptyOrWhitespaces( handler ))
				this.errors.add( new ModelError( ErrorCode.REC_TARGET_NO_HANDLER, this.modelObject, details ));

			String name = this.props.getProperty( Constants.TARGET_PROPERTY_NAME );
			if( Utils.isEmptyOrWhitespaces( name ))
				this.errors.add( new ModelError( ErrorCode.REC_TARGET_NO_NAME, this.modelObject, details ));
		}
	}
130735
def update_metric(self, eval_metric, labels, pre_sliced=False):
        
        assert self.binded and self.params_initialized

        for meta, module in zip(self._metas, self._modules):
            if SequentialModule.META_TAKE_LABELS in meta and \
                    meta[SequentialModule.META_TAKE_LABELS]:
                module.update_metric(eval_metric, labels, pre_sliced)
801360
private final function loadValidation(): void
    {
        $this->validation = new Validation();

        $rules = $this->config->get('validation.rules');
        if ($rules != null) {
            $this->validation->setRules($rules);
        }
    }
119
def validate(self):
    """"""
    # PASS if all our validators return True, otherwise FAIL.
    try:
      if all(v(self.measured_value.value) for v in self.validators):
        self.outcome = Outcome.PASS
      else:
        self.outcome = Outcome.FAIL
      return self
    except Exception as e:  # pylint: disable=bare-except
      _LOG.error('Validation for measurement %s raised an exception %s.',
                 self.name, e)
      self.outcome = Outcome.FAIL
      raise
    finally:
      if self._cached:
        self._cached['outcome'] = self.outcome.name
147630
def _raise_error_evaluation_metric_is_valid(metric, allowed_metrics):
    

    err_msg = "Evaluation metric '%s' not recognized. The supported evaluation"
    err_msg += " metrics are (%s)."

    if metric not in allowed_metrics:
      raise ToolkitError(err_msg % (metric,
                          ', '.join(map(lambda x: "'%s'" % x, allowed_metrics))))
234849
public function validate() : void
    {
        $this->value = null;
        $value = $this->filter($this->raw_value);
        if (true === $this->checkValidity($value)) {
            $this->is_valid = true;
        } else {
            $this->is_valid = false;
            $this->reportError($this->error_message);
            $error_message = sprintf($this->error_message, $this->field_name);
            $this->the_message = $error_message;
        }
        // If no issues have been found, check the constraints.
        if ($this->is_valid) {
            foreach ($this->constraints as $constraint) {
                if (false === $constraint->check($value)) {
                    $this->is_valid = false;
                    $this->the_message = sprintf($constraint->getErrorMessage(), $this->field_name);
                }
            }
        }
        // Set the value for retrieval
        if ($this->is_valid) {
            $this->value = $value;
        }
    }
765902
def patch(self, patch):
        """"""
        # explicitly pick out the parts to update so we don't inadvertently
        # step on the model name or anything
        self._contents.update({
            'patch_path': patch.original_file_path,
            'description': patch.description,
            'columns': patch.columns,
            'docrefs': patch.docrefs,
        })
        # patches always trigger re-validation
        self.validate()
349721
public void validate() {
    if (metric == null || metric.isEmpty()) {
      throw new IllegalArgumentException("missing or empty metric");
    }

    if (id == null || id.isEmpty()) {
      throw new IllegalArgumentException("missing or empty id");
    }
    Query.validateId(id);

    if (time_offset != null) {
      DateTime.parseDateTimeString(time_offset, null);
    }
    
    if (aggregator != null && !aggregator.isEmpty()) {
      try {
        Aggregators.get(aggregator.toLowerCase());
      } catch (final NoSuchElementException e) {
        throw new IllegalArgumentException("Invalid aggregator");
      }
    }

    if (fill_policy != null) {
      fill_policy.validate();
    }
  }
592403
public function afterValidate()
    {
        parent::afterValidate(); // TODO: Change the autogenerated stub

        $this->dataProperties->validate();

        $this->addErrors($this->dataProperties->getErrors());
    }