【问题标题】:How to define a feature spec for multi-output regression neural network?如何为多输出回归神经网络定义特征规范?
【发布时间】:2021-06-29 12:54:20
【问题描述】:

根据 Rstudiothis Tensorflow tutorial,我们可以使用以下方法定义spec(预处理我们的tensor 数据):

library(keras)
library(tfdatasets)
spec <- feature_spec(train_dataset, y ~ .)

但是,我正在使用Keras 处理多输出回归问题(多输出神经网络),这意味着我有多个yresponse 变量。我尝试使用以下方法定义spec

spec <- feature_spec(train_dataset, c(y1, y2, y3, y4, y5) ~ .)

但这给了我一个错误:

Error in validate_formula_operators(formula[[i]]) : 
  unhandled formula operator: expected '+' or '-'; got 'c'

我怎样才能做到这一点?

【问题讨论】:

  • “不起作用”如何?你有任何错误吗?
  • @mhovd 请查看更新
  • 尝试使用cbind() 而不是c()
  • @mhovd 这是我使用cbind()时得到的结果:Error in validate_formula_operators(formula[[i]]) : unhandled formula operator: expected '+' or '-'; got 'cbind'

标签: r tensorflow keras tensorflow-datasets


【解决方案1】:

很遗憾,feature_spec() (https://github.com/rstudio/tfdatasets/issues/88) 目前不支持多个响应变量。

【讨论】:

    猜你喜欢
    • 2019-08-19
    • 2013-10-20
    • 2020-05-01
    • 2020-04-29
    • 1970-01-01
    • 1970-01-01
    • 2019-01-27
    • 2012-01-16
    相关资源
    最近更新 更多