Declare the outputs of the algorithms as attributes: x_final,
        y_final, metrics.
356528
def retrieve_outputs(self):
        

        metrics = {}
        for obs in self._observers['cv_metrics']:
            metrics[obs.name] = obs.retrieve_metrics()
        self.metrics = metrics
86445
def output(self):
        
        starters = self.finalize()
        try:
            yield from self._output(starters)
        finally:
            self.close()
497540
public static void setCommonAttributes(List<Metric> metrics, Metric result) {
        MetricDistiller distiller = new MetricDistiller();

        distiller.distill(metrics);
        result.setDisplayName(distiller.getDisplayName());
        result.setUnits(distiller.getUnits());
        result.setTags(distiller.getTags());
    }
896964
def on_epoch_end(self, epoch:int, num_batch:int, smooth_loss:Tensor,
                     last_metrics=MetricsList, **kwargs:Any)->bool:
        ""
        self.nb_batches.append(num_batch)
        if last_metrics is not None: self.val_losses.append(last_metrics[0])
        else: last_metrics = [] if self.no_val else [None]
        if len(last_metrics) > 1: self.metrics.append(last_metrics[1:])
        self.format_stats([epoch, smooth_loss] + last_metrics)
943280
def _publish_metrics(self, prev_keys, key, data, publishfn=None):
        """"""
        if key not in data:
            return
        value = data[key]
        keys = prev_keys + [key]
        if not publishfn:
            publishfn = self.publish
        if isinstance(value, dict):
            for new_key in value:
                self._publish_metrics(keys, new_key, value)
        elif isinstance(value, int) or isinstance(value, float):
            publishfn('.'.join(keys), value)
        elif isinstance(value, long):
            publishfn('.'.join(keys), float(value))
385459
def process_metrics(self, snmp_data):
        ""
        self.metrics = {}
        for i in range(0, len(snmp_data)):
            metric_id = self.models[self.modem_type]['metrics'][i]
            value = int(snmp_data[i])
            self.metrics[metric_id] = value
872580
def _post_compute(self):
        """"""
        self._x_labels, self._y_labels = self._y_labels, self._x_labels
        self._x_labels_major, self._y_labels_major = (
            self._y_labels_major, self._x_labels_major
        )
        self._x_2nd_labels, self._y_2nd_labels = (
            self._y_2nd_labels, self._x_2nd_labels
        )
        self.show_y_guides, self.show_x_guides = (
            self.show_x_guides, self.show_y_guides
        )
678663
def add_metrics(self, metrics: Iterable[float]) -> None:
        
        for metric in metrics:
            self.add_metric(metric)
1241214
def get_final_attrs(self, classes=True):
        """"""
        final_attrs = copy.copy(self.get_default_attrs())
        final_attrs.update(self.attrs)
        if classes:
            final_attrs['class'] = self.get_final_css()
        else:
            final_attrs.pop('class', None)

        return final_attrs
283541
def output_results(cls, sprites):
        
        print(' '.join(cls.ATTRIBUTES))
        format_strs = ['{{{}!s:^{}}}'.format(x, len(x)) for x in
                       cls.ATTRIBUTES]
        print(' '.join(format_strs).format(**cls.attribute_result(sprites)))
127824
def _finalize(self):
        ""
        hobj = self._hobj
        for hashname in self._algorithms[1:]:
            fobj = hashlib.new(hashname)
            fobj.update(hobj.digest())
            hobj = fobj
        self._fobj = hobj
107049
def _finalized_internal(self,
                          context,
                          pipeline_key,
                          root_pipeline_key,
                          caller_output,
                          aborted):
    """"""
    result_status = _PipelineRecord.RUN
    if aborted:
      result_status = _PipelineRecord.ABORTED

    self._set_values_internal(
        context, pipeline_key, root_pipeline_key, caller_output, result_status)
    logging.debug('Finalizing %s(*%r, **%r)#%s',
                  self._class_path, _short_repr(self.args),
                  _short_repr(self.kwargs), self._pipeline_key.name())
    try:
      self.finalized()
    except NotImplementedError:
      pass
574637
def on_batch_end(self, last_target, train, **kwargs):
        ""
        if train: return
        bs = last_target.size(0)
        for name in self.names:
            self.metrics[name] += bs * self.learn.loss_func.metrics[name].detach().cpu()
        self.nums += bs
839376
final void doScoring(Frame _train, Frame _trainOrig, Frame _valid, Frame _validOrig) {
    ModelMetrics mm = makeMetrics(_train, _trainOrig, true, "Metrics reported on training frame");
    _output._training_metrics = mm;
    _output._scored_train[_output._ntrees].fillFrom(mm);
    addModelMetrics(mm);
    // Optional validation part
    if (_valid!=null) {
      mm = makeMetrics(_valid, _validOrig, false, "Metrics reported on validation frame");
      _output._validation_metrics = mm;
      _output._scored_valid[_output._ntrees].fillFrom(mm);
      addModelMetrics(mm);
    }
  }
328187
def _finalize_ticks(self, axis, element, xticks, yticks, zticks):
        
        yalignments = None
        if xticks is not None:
            ticks, labels, yalignments = zip(*sorted(xticks, key=lambda x: x[0]))
            xticks = (list(ticks), list(labels))
        super(BarPlot, self)._finalize_ticks(axis, element, xticks, yticks, zticks)
        if yalignments:
            for t, y in zip(axis.get_xticklabels(), yalignments):
                t.set_y(y)
1287972
def merge_metrics(self):
        

        self.metrics.extend(self._metrics.values())
        del self._metrics
1140307
def output_metric(gandi, metrics, key, justify=10):
    
    for metric in metrics:
        key_name = metric[key].pop()
        values = [point.get('value', 0) for point in metric['points']]
        graph = sparks(values) if max(values) else ''
        # need to encode in utf-8 to work in python2.X
        if sys.version_info < (2, 8):
            graph = graph.encode('utf-8')
        output_line(gandi, key_name, graph, justify)