Add model to the history, x_queue and y_queue

        Parameters
        ----------
        metric_value : float
        graph : dict
        model_id : int

        Returns
        -------
        model : dict
966754
def add_model(self, metric_value, model_id):
        
        if self.verbose:
            logger.info("Saving model.")

        # Update best_model text file
        ret = {"model_id": model_id, "metric_value": metric_value}
        self.history.append(ret)
        if model_id == self.get_best_model_id():
            file = open(os.path.join(self.path, "best_model.txt"), "w")
            file.write("best model: " + str(model_id))
            file.close()
        return ret
569499
def get_model(self, sm_id):
        
        sm = self.source_models[sm_id]
        if self.source_model_lt.num_samples:
            self.source_model_lt.num_samples = sm.samples
        new = self.__class__(self.gsim_lt, self.source_model_lt, [sm],
                             self.optimize_same_id)
        new.sm_id = sm_id
        return new
779398
def _write_metrics(self, iteration:int, last_metrics:MetricsList, start_idx:int=2)->None:
        ""
        recorder = self.learn.recorder
        for i, name in enumerate(recorder.names[start_idx:]):
            if last_metrics is None or len(last_metrics) < i+1: return
            scalar_value = last_metrics[i]
            self._write_scalar(name=name, scalar_value=scalar_value, iteration=iteration)
196118
def get_frame(self):
        
        metric_items = list(self.db.metrics.find({'run_name': self.model_config.run_name}).sort('epoch_idx'))
        if len(metric_items) == 0:
            return pd.DataFrame(columns=['run_name'])
        else:
            return pd.DataFrame(metric_items).drop(['_id', 'model_name'], axis=1).set_index('epoch_idx')
40224
def metrics_incremental(self, start_time):
        
        return self._query_zendesk(self.endpoint.metrics.incremental, 'ticket_metric_events', start_time=start_time)
609905
def insert_metric_changes(db, metrics, metric_mapping, commit):
    
    values = [
        [commit.sha, metric_mapping[metric.name], metric.value]
        for metric in metrics
        if metric.value != 0
    ]
    db.executemany(
        'INSERT INTO metric_changes (sha, metric_id, value) VALUES (?, ?, ?)',
        values,
    )
49394
async def get_metrics(self):
        
        metrics = await self.model.get_metrics(self.tag)
        return metrics[self.name]
851934
def load_graphdef(model_url, reset_device=True):
  """"""
  graph_def = load(model_url)

  if reset_device:
    for n in graph_def.node:
      n.device = ""

  return graph_def
416966
def accumulate_metric(cls, name, value):
        
        metrics_cache = cls._get_metrics_cache()
        metrics_cache.setdefault(name, 0)
        metrics_cache.set(name, value)
1229992
def updateModel(self, X_all, Y_all, X_new, Y_new):
        
        self.X = X_all
        self.Y = Y_all
        if self.model is None:
            self._create_model(X_all, Y_all)
        else:
            self.model.fit(X_all, Y_all.flatten())
440567
def _add_single_metric(self, timestamp, metric_name, value):
        
        # note that this method is built this way to make it possible to
        # support live-refreshing charts in Bokeh at some point in the future.
        self._data['timestamp'].append(timestamp)
        self._data['metric_name'].append(metric_name)
        self._data['value'].append(value)
1139238
def get_flow_by_id(self, flow_id):
        
        tmp_flows = self.diagram_graph.edges(data=True)
        for flow in tmp_flows:
            if flow[2][consts.Consts.id] == flow_id:
                return flow
1081429
def process(self, metric):
        
        metric = self.key + '.' + str(metric)
        self.graphite.process(metric)
78085
def add_metric(self, metric: float) -> None:
        
        new_best = ((self._best_so_far is None) or
                    (self._should_decrease and metric < self._best_so_far) or
                    (not self._should_decrease and metric > self._best_so_far))

        if new_best:
            self.best_epoch = self._epoch_number
            self._is_best_so_far = True
            self._best_so_far = metric
            self._epochs_with_no_improvement = 0
        else:
            self._is_best_so_far = False
            self._epochs_with_no_improvement += 1
        self._epoch_number += 1
658971
def get_metric(run_id, metric_id):
    
    data = current_app.config["data"]  # type: DataStorage
    dao = data.get_metrics_dao()
    metric = dao.get(run_id, metric_id)

    return Response(render_template(
        "api/metric.js",
        run_id=metric["run_id"],
        metric_id=metric["metric_id"],
        name=metric["name"],
        steps=metric["steps"],
        timestamps=metric["timestamps"],
        values=metric["values"]),
        mimetype="application/json")
546209
def add(object)
      key, id = to_key_and_id(object)

      @graph[key] ? @graph[key] << id : @graph[key] = [id]
    end
337858
def _set_request_user_id_metric(self, request):
        
        if hasattr(request, 'user') and hasattr(request.user, 'id') and request.user.id:
            monitoring.set_custom_metric('request_user_id', request.user.id)