Tag: 意味着

Numpy和Tensorflow中的np.mean和tf.reduce_mean之间的区别?

在MNIST初学者教程中 ,有accuracy = tf.reduce_mean(tf.cast(correct_prediction, "float")) tf.cast基本上改变了对象的张量types,但是tf.reduce_mean和np.mean什么np.mean呢? 这里是关于tf.reduce_mean的文档: reduce_mean(input_tensor, reduction_indices=None, keep_dims=False, name=None) input_tensor: The tensor to reduce. Should have numeric type. reduction_indices: The dimensions to reduce. If `None` (the defaut), reduces all dimensions. # 'x' is [[1., 1. ]] # [2., 2.]] tf.reduce_mean(x) ==> 1.5 tf.reduce_mean(x, 0) ==> [1.5, 1.5] tf.reduce_mean(x, 1) ==> [1., 2.] 对于一维vector,它看起来像np.mean […]

读取多个文件并根据用户input计算平均值

我想在R中写一个函数,它需要3个input: 目录 污染物 ID 我的电脑上有一个目录,里面装满了CSV文件,比如300多个。这个函数的function如下: pollutantmean <- function(directory, pollutant, id = 1:332) { ## 'directory' is a character vector of length 1 indicating ## the location of the CSV files ## 'pollutant' is a character vector of length 1 indicating ## the name of the pollutant for which we will calculate the ## mean; either […]