r neuralnet 包——多输出
r neuralnet package -- multiple output
我目前使用神经网络的方式是从多个输入点预测一个输出点。更具体地说,我 运行 下面。
nn <- neuralnet(
as.formula(a ~ c + d),
data=Z, hidden=c(3,2), err.fct="sse", act.fct=custom,
linear.output=TRUE, rep=5)
在这里,如果 Z 是一个由名称为 a、b、c 的列组成的矩阵,它将根据行 c 和 d 中的对应点预测列 a 中一行中的一个点。 (垂直维度用作训练样本。)
假设还有一列b。我想知道是否有办法从 c 和 d 预测 a 和 b?我试过了
as.formula(a+b ~ c+d)
但这似乎不起作用。
有什么想法吗?
糟糕,使用 a + b ~ c + d 效果很好。我以为这个函数不接受这个输入(因为它崩溃了很多次),但肯定还有另一个问题,现在我把它全部清理干净了。
nn <- neuralnet(as.formula(a + b ~ c + d),
data=Z, hidden=c(3,2), err.fct="sse", act.fct=custom,
linear.output=TRUE, rep=5)
工作精美,returns 两点(或两列)输出!整洁
示例来自 neuralnet
,格式有效:)
AND <- c(rep(0,7),1)
OR <- c(0,rep(1,7))
binary.data <- data.frame(expand.grid(c(0,1), c(0,1), c(0,1)), AND, OR)
print(net <- neuralnet(AND+OR~Var1+Var2+Var3, binary.data, hidden=0,
rep=10, err.fct="ce", linear.output=FALSE))
我目前使用神经网络的方式是从多个输入点预测一个输出点。更具体地说,我 运行 下面。
nn <- neuralnet(
as.formula(a ~ c + d),
data=Z, hidden=c(3,2), err.fct="sse", act.fct=custom,
linear.output=TRUE, rep=5)
在这里,如果 Z 是一个由名称为 a、b、c 的列组成的矩阵,它将根据行 c 和 d 中的对应点预测列 a 中一行中的一个点。 (垂直维度用作训练样本。)
假设还有一列b。我想知道是否有办法从 c 和 d 预测 a 和 b?我试过了
as.formula(a+b ~ c+d)
但这似乎不起作用。
有什么想法吗?
糟糕,使用 a + b ~ c + d 效果很好。我以为这个函数不接受这个输入(因为它崩溃了很多次),但肯定还有另一个问题,现在我把它全部清理干净了。
nn <- neuralnet(as.formula(a + b ~ c + d),
data=Z, hidden=c(3,2), err.fct="sse", act.fct=custom,
linear.output=TRUE, rep=5)
工作精美,returns 两点(或两列)输出!整洁
示例来自 neuralnet
,格式有效:)
AND <- c(rep(0,7),1)
OR <- c(0,rep(1,7))
binary.data <- data.frame(expand.grid(c(0,1), c(0,1), c(0,1)), AND, OR)
print(net <- neuralnet(AND+OR~Var1+Var2+Var3, binary.data, hidden=0,
rep=10, err.fct="ce", linear.output=FALSE))