r - 在 R 中获取神经网络的恒定输出(net.result)
问题描述
我正在尝试运行一个神经网络模型来预测以下数据集中 y 的值(下面提供的 dput):
structure(list(feature1 = c(1, 1, 1, 1, 1), feature3 = c(2, 1,
2, 2, 1), feature4 = c(5.20909584705607, 4.45094060803504, 5.39655180066883,
4.97016301474876, 5.26686796952951), feature5 = c(9789.26151130325,
10552.5218988245, 10233.4331187079, 10829.0567458179, 10678.7036869759
), feature7 = c(0.00101042237609137, 0.000999767963117104, 0.00101456547642991,
0.000992996484855727, 0.00100941888927906), feature9 = c(13L,
11L, 13L, 8L, 11L), y = c(0L, 0L, 0L, 1L, 0L)), row.names = c(NA,
5L), class = "data.frame")
我用于构建神经网络的代码如下所示:
library(neuralnet)
ann <- neuralnet(y~., train_model, hidden = c(2,2), act.fct = "tanh")
plot(ann)
ann$net.result
该模型运行良好,误差为 106。但是,当我尝试查看 net.results 时,我得到所有观测值的恒定概率为 0.31。
解决方案
推荐阅读
- c# - NUnit 错误:找不到测试用例源
- javascript - 如果只有一个,则自动返回数组的第一项
- vb.net - Visual Basic 缺少用于函数识别的括号
- jsf - JSF渲染嵌入式面板列表ajax不起作用
- python - Python Unittest Discover即使失败也返回退出代码0
- python-3.7 - 强类型 python3.7 - 返回类型和参数不失败
- jekyll - netlify cms 管理员登录时未捕获的类型错误
- node.js - 使用 mod_cluster willdfly 将 url apache 重写为 nodeJS 的问题
- jquery - 发送 Ninja Forms 表单时,jQuery“提交”不起作用
- mysql - MySQL 错误 #1415 - 不允许从函数返回结果集