小编ac2*_*051的帖子

具有内存数据的分布式TensorFlow

我需要随机生成合成的内存数据(以pandas DataFrames的形式),并将其提供给分布在多个参数服务器和工作器上的TensorFlow Estimator.我怎样才能做到这一点?哪个服务器应该负责生成数据,如何将它们传递给其他服务器?沿着这些方向会有什么作用吗?

def main(_):
    ps_hosts = FLAGS.ps_hosts.split(",")
    worker_hosts = FLAGS.worker_hosts.split(",")
    #Create a cluster from the parameter server and worker hosts.
    cluster = tf.train.ClusterSpec({"ps": ps_hosts, "worker": worker_hosts})
    #Create and start a server for the local task.
    server = tf.train.Server(cluster, job_name=FLAGS.job_name, task_index=FLAGS.task_index)

    if FLAGS.job_name == "ps":
        server.join()
    elif FLAGS.job_name == "worker":
        if FLAGS.task_index==0:
            train_data, train_labels = generate_synthetic_data()
            eval_data, eval_labels = generate_synthetic_data()
            test_data, test_labels  = generate_synthetic_data()

    with tf.device(tf.train.replica_device_setter( worker_device="/job:worker/task:%d" % FLAGS.task_index, cluster=cluster)):

        # Run training
        train_and_evaluate()

if __name__ == "__main__":
    tf.app.run(main=main, argv=[sys.argv[0]]) …
Run Code Online (Sandbox Code Playgroud)

python tensorflow tensorflow-datasets

6
推荐指数
1
解决办法
146
查看次数

在lm回归中使用偏移 - R.

我有这个程序

dens <- read.table('DensPiu.csv', header = FALSE)
fl <- read.table('FluxPiu.csv', header = FALSE)
mydata <- data.frame(c(dens),c(fl))

dat = subset(mydata, dens>=3.15)
colnames(dat) <- c("x", "y")
attach(dat)
Run Code Online (Sandbox Code Playgroud)

我想对dat中包含的数据进行最小二乘回归,函数有表格

y ~ a + b*x
Run Code Online (Sandbox Code Playgroud)

我希望回归线通过一个特定的点P(x0,y0)(它不是原点).

我想这样做

 x0 <- 3.15 

 y0 <-283.56

 regression <- lm(y ~ I(x-x0)-1, offset=y0)
Run Code Online (Sandbox Code Playgroud)

(我认为在这种情况下data = dat不是必需的)但我有这个错误:

Error in model.frame.default(formula = y ~ I(x - x0) - 1, : variable
 lengths differ (found for '(offset)').
Run Code Online (Sandbox Code Playgroud)

我不知道为什么.我想我没有正确定义偏移值,但我在互联网上找不到任何例子.

任何人都可以解释一下偏置是如何工作的吗?

r lm

5
推荐指数
1
解决办法
1万
查看次数

约束最小二乘回归 - Matlab或R.

我正在对一些数据进行最小二乘回归,函数具有形式

y ~ a + b*x
Run Code Online (Sandbox Code Playgroud)

我希望回归线通过特定点P(x,y)(不是原点).我怎样才能做到这一点?

我在R中使用lm命令,在Matlab中使用基本拟合GUI.我认为我可以使用constrOptim命令(在R中)或将原点转换为P点,但我想知道是否有特定的命令来执行此操作.

我只需要其中一个程序的解决方案,然后我就可以使用另一个程序中的系数.

matlab r linear-regression

4
推荐指数
1
解决办法
1191
查看次数

Matlab - hist函数不显示任何内容

我想显示5个直方图,它们有5个不同的矢量大小(1,264)(1,262)(1,262)(1,264)(1,262).对于每个向量,我只是这样做

[count, bin] = hist(Vi)
Run Code Online (Sandbox Code Playgroud)

其中Vi是向量的名称.

我知道了

count = 2     6     2     6    22   202     3     2     4    15
bin = -0.0959   -0.0763   -0.0567   -0.0370   -0.0174    0.0023    0.0219    0.0416    0.0612  0.0808

count = 2     0     0     8     6    26   191     0     9    20
bin = -0.1352   -0.1116   -0.0879   -0.0643   -0.0406   -0.0169    0.0067    0.0304    0.0540    0.0777

count = 2     6     0     2     6   202     0     0    12    32
bin = -0.1219   -0.0995   -0.0772   -0.0548   -0.0324   -0.0100    0.0123    0.0347    0.0571    0.0795

count …
Run Code Online (Sandbox Code Playgroud)

matlab histogram matlab-figure

2
推荐指数
1
解决办法
2180
查看次数