• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python metric_ops.streaming_mean函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中tensorflow.contrib.metrics.python.ops.metric_ops.streaming_mean函数的典型用法代码示例。如果您正苦于以下问题:Python streaming_mean函数的具体用法?Python streaming_mean怎么用?Python streaming_mean使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了streaming_mean函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: _sigmoid_entropy

def _sigmoid_entropy(probabilities, targets, weights=None):
  return metric_ops.streaming_mean(
      losses.sigmoid_cross_entropy(probabilities,
                                   _squeeze_and_onehot(
                                       targets,
                                       array_ops.shape(probabilities)[1])),
      weights=weights)
开发者ID:LUTAN,项目名称:tensorflow,代码行数:7,代码来源:eval_metrics.py


示例2: _r2

def _r2(probabilities, targets, weights=None):
  targets = math_ops.to_float(targets)
  y_mean = math_ops.reduce_mean(targets, 0)
  squares_total = math_ops.reduce_sum(math_ops.square(targets - y_mean), 0)
  squares_residuals = math_ops.reduce_sum(
      math_ops.square(targets - probabilities), 0)
  score = 1 - math_ops.reduce_sum(squares_residuals / squares_total)
  return metric_ops.streaming_mean(score, weights=weights)
开发者ID:Jackiefan,项目名称:tensorflow,代码行数:8,代码来源:eval_metrics.py


示例3: _r2

def _r2(probabilities, targets):
    if targets.get_shape().ndims == 1:
        targets = array_ops.expand_dims(targets, -1)
    y_mean = math_ops.reduce_mean(targets, 0)
    squares_total = math_ops.reduce_sum(math_ops.square(targets - y_mean), 0)
    squares_residuals = math_ops.reduce_sum(math_ops.square(targets - probabilities), 0)
    score = 1 - math_ops.reduce_sum(squares_residuals / squares_total)
    return metric_ops.streaming_mean(score)
开发者ID:ChaitanyaCixLive,项目名称:tensorflow,代码行数:8,代码来源:eval_metrics.py


示例4: get_eval_ops

 def get_eval_ops(self, features, logits, labels, metrics=None):
   loss = self.loss(logits, labels, features)
   result = {"loss": metric_ops.streaming_mean(loss)}
   if metrics:
     predictions = self.logits_to_predictions(logits, proba=False)
     result.update(
         _run_metrics(predictions, labels, metrics,
                      self.get_weight_tensor(features)))
   return result
开发者ID:Albert-Z-Guo,项目名称:tensorflow,代码行数:9,代码来源:target_column.py


示例5: build_graph

  def build_graph(self, data_paths, batch_size, is_training):
    """Builds generic graph for training or eval."""
    tensors = GraphReferences()

    _, tensors.examples = util.read_examples(
        data_paths,
        batch_size,
        shuffle=is_training,
        num_epochs=None if is_training else 2)

    parsed = parse_examples(tensors.examples)

    # Build a Graph that computes predictions from the inference model.
    logits = inference(parsed['images'], self.hidden1, self.hidden2)

    # Add to the Graph the Ops for loss calculation.
    loss_value = loss(logits, parsed['labels'])

    # Add to the Graph the Ops for accuracy calculation.
    accuracy_value = evaluation(logits, parsed['labels'])

    # Add to the Graph the Ops that calculate and apply gradients.
    if is_training:
      tensors.train, tensors.global_step = training(loss_value,
                                                    self.learning_rate)
    else:
      tensors.global_step = tf.Variable(0, name='global_step', trainable=False)

    # Add streaming means.
    loss_op, loss_update = metric_ops.streaming_mean(loss_value)
    accuracy_op, accuracy_update = metric_ops.streaming_mean(accuracy_value)

    tf.scalar_summary('accuracy', accuracy_op)
    tf.scalar_summary('loss', loss_op)

    # HYPERPARAMETER TUNING: Write the objective value.
    if not is_training:
      tf.scalar_summary('training/hptuning/metric', accuracy_op)

    tensors.metric_updates = [loss_update, accuracy_update]
    tensors.metric_values = [loss_op, accuracy_op]
    return tensors
开发者ID:obulpathi,项目名称:cloud,代码行数:42,代码来源:model.py


示例6: _predictions_streaming_mean

def _predictions_streaming_mean(predictions, unused_labels, weights=None):
  return metric_ops.streaming_mean(predictions, weights=weights)
开发者ID:Albert-Z-Guo,项目名称:tensorflow,代码行数:2,代码来源:target_column.py


示例7: _class_log_loss

def _class_log_loss(probabilities, targets, weights=None):
  return metric_ops.streaming_mean(
      losses.log_loss(probabilities,
                      _squeeze_and_onehot(targets,
                                          array_ops.shape(probabilities)[1])),
      weights=weights)
开发者ID:DavidNemeskey,项目名称:tensorflow,代码行数:6,代码来源:eval_metrics.py


示例8: _softmax_entropy

def _softmax_entropy(probabilities, targets, weights=None):
  return metric_ops.streaming_mean(losses.sparse_softmax_cross_entropy(
      probabilities, math_ops.to_int32(targets)),
                                   weights=weights)
开发者ID:DavidNemeskey,项目名称:tensorflow,代码行数:4,代码来源:eval_metrics.py


示例9: _top_k

 def _top_k(probabilities, targets):
   targets = math_ops.to_int32(targets)
   if targets.get_shape().ndims > 1:
     targets = array_ops.squeeze(targets, squeeze_dims=[1])
   return metric_ops.streaming_mean(nn.in_top_k(probabilities, targets, k))
开发者ID:LUTAN,项目名称:tensorflow,代码行数:5,代码来源:eval_metrics.py


示例10: _softmax_entropy

def _softmax_entropy(probabilities, targets):
  return metric_ops.streaming_mean(losses.softmax_cross_entropy(
      probabilities, targets))
开发者ID:363158858,项目名称:tensorflow,代码行数:3,代码来源:eval_metrics.py


示例11: _sigmoid_entropy

def _sigmoid_entropy(probabilities, targets):
  return metric_ops.streaming_mean(losses.sigmoid_cross_entropy(
      probabilities, targets))
开发者ID:363158858,项目名称:tensorflow,代码行数:3,代码来源:eval_metrics.py


示例12: _top_k

 def _top_k(probabilities, targets):
   return metric_ops.streaming_mean(nn.in_top_k(probabilities,
                                                math_ops.to_int32(targets), k))
开发者ID:ComeOnGetMe,项目名称:tensorflow,代码行数:3,代码来源:eval_metrics.py


示例13: _log_loss

def _log_loss(probabilities, targets):
  # targets doesn't have a shape coming in, log_loss isn't too happy about it.
  targets = array_ops.reshape(targets, array_ops.shape(probabilities))
  return metric_ops.streaming_mean(losses.log_loss(probabilities, targets))
开发者ID:821760408-sp,项目名称:tensorflow,代码行数:4,代码来源:eval_metrics.py



注:本文中的tensorflow.contrib.metrics.python.ops.metric_ops.streaming_mean函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python anno.getanno函数代码示例发布时间:2022-05-27
下一篇:
Python metrics.streaming_mean函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap