- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
h1 i-6ren">
我正在使用 Caret 包使用“nnet”方法训练模型。它正在工作,但我需要查看隐藏层中使用的权重。当我们直接使用 nnet 函数时,这是可能的:
model<-nnet(Data[5:8], Data[4],size=10,maxit=100000,linout=T,decay=0.1)
model$wts
[1] 9.160050e-01 1.184379e+00 -1.201645e+00 1.041427e+00 -2.367287e-03 6.861753e+00 1.223522e+00 -1.875841e+01 -1.233203e-02
[10] 5.281464e-01 -1.605204e+00 1.497933e+00 -2.882815e+00 -1.511277e+01 2.732411e-01 -2.999315e+01 1.498460e-01 -9.405826e-01
[19] -2.800337e+00 9.600647e-02 1.588405e+00 -2.106175e+00 -8.807753e+00 2.762392e+01 2.091118e-01 3.265564e+01 6.516821e-01
[28] 1.304455e-01 -7.633166e+00 1.017017e-02 6.366411e+01 -2.902564e-02 1.376147e-01 -8.353788e+00 6.376588e-04 5.995577e+00
[37] 1.176301e+01 -8.569926e+00 1.971122e+01 -2.358067e-01 3.971781e+01 1.940421e-01 1.755913e-01 -5.817047e+00 1.988909e-03
[46] 1.408106e+00 -1.549250e+00 1.757245e+01 -5.760102e+01 1.001197e+00 -5.493371e+00 4.786298e+00 6.049659e+00 -1.762611e+01
[55] -9.598485e+00 -1.716196e+01 6.477683e+00 -1.971476e+01 4.468062e+00 2.125993e+01 4.683170e+01
使用 caret 包时如何查看权重?
mynnetfit <- train(DC ~ T+c+f+h, data = Data1, method = "nnet",
maxit = 1000, tuneGrid = my.grid, trace = T, linout = 1, trControl = ctrl)
最佳答案
模型对象 mynnetfit
有一个 finalModel
组件,它属于 nnet
类。然后,您可以通过 coef(mynnetfit$finalModel)
获取节点的权重。
例如
library(caret)
## simulate data
set.seed(1)
dat <- LPH07_2(100, 20)
mod <- train(y ~ ., data=dat, method="nnet", trace=FALSE, linout=TRUE)
coef(mod$finalModel)
b->h1 i1->h1 i2->h1 i3->h1 i4->h1 i5->h1 i6->h1 i7->h1 i8->h1 i9->h1
-0.7622230 8.5760791 9.6162685 -13.0549859 5.3306854 8.1679126 3.1832575 -5.4354694 4.8410017 -6.3811887
i10->h1 i11->h1 i12->h1 i13->h1 i14->h1 i15->h1 i16->h1 i17->h1 i18->h1 i19->h1
7.0813781 3.4709351 5.6444663 4.2530566 0.6594511 0.5579828 23.5802215 5.0381758 -0.4883967 -13.0613378
i20->h1 i21->h1 i22->h1 i23->h1 i24->h1 i25->h1 i26->h1 i27->h1 i28->h1 i29->h1
11.8905272 -0.2732984 -4.5190578 -2.3095693 0.8891562 1.7922645 -0.4666446 -1.0980723 -4.7742597 -5.1603453
i30->h1 i31->h1 i32->h1 i33->h1 i34->h1 i35->h1 i36->h1 i37->h1 i38->h1 i39->h1
-0.1285864 2.2160653 0.2990097 -5.1722264 -4.8375324 1.4537326 -1.6870400 -2.1019009 1.3542151 0.7036545
i40->h1 b->o h1->o
-2.1592154 10.7700684 -27.4712736
关于r - Caret Package with "nnet"查看隐藏层的权重,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23495761/
我有几个系统,其中包含用户表以及某种形式的业力/权重/声誉。有时是用户发布的帖子数量,有时是用户在网站上的所有事件中收到的赞成/反对票数。 USER { id int name str
我需要能够使用填充的相对大小 - 根据设备的分辨率和 dpi 变大或变小。 例如,如果我的 View 宽度为 100 像素,我希望左侧填充 10 像素,右侧填充 10 像素。但是,如果它在更高密度的屏
我目前正在使用由大约 10 个字段组成的 Solr 索引数据。当我执行搜索时,我希望某些字段的权重更高。谁能帮我指出正确的方向? 例如,在所有字段中搜索“超人”等术语时,应在“Description”
我正在使用 igraph 模拟网络随时间的变化在 r并且我正在寻找一种有效且可扩展的方式来对此进行编码以用于业务。 网络变化的主要驱动因素是: 新增节点 新领带 新节点权重 在第一阶段,在 100 个
我一直在寻找一种使用OpenVINO框架上的C++ API获取网络每一层权重/参数和偏差张量的方法。我在文档中找不到任何内容,在示例中也找不到任何示例。我如何提取这些张量? 谢谢, 塞萨尔 编辑: 分
我的问题与 PHP Memcache 扩展的 addServer 函数中的“weight”参数有关。 在过去的几个月里,我一直在为所有服务器使用“weight = 1”。我现在正在尝试应用以下配置以最
我应该使用哪种数据结构来保持元素按给定权重排序?我需要在集合中添加元素,其中每个元素都会生成特定的权重,但该权重不包含(也不计算)在元素本身内部;它是由元素之外的其他人计算的。而且,权重不需要存储(但
我正在尝试在 keras/tensorflow 中使用具有多个类的焦点损失,这导致使用我猜的分类焦点损失。我找到了一些实现here和 there或there 。 据我了解,焦点损失中的参数a主要用于二
我有一个像这样的 Pandas 数据框: df = pd.DataFrame({'id': [121, 34324, 111, 12, 45, 232], 'weight'
我有一个带有输出神经元的神经网络,我想在软最大化之前使用经过训练的权重进行线性缩放。 我有 10 个输出,我想要 10 个权重,在输出被软最大化之前乘以每个输出。因此每个输出的权重为 1。 但我不断收
我有这样的布局: 我希望它看起来像: TextView - 宽度的 40%,带 ImageView 的布局
这让我彻底疯了。我想在 android 中使用有点复杂的布局。我正在尝试使用权重而不是固定事物的大小。也许我应该放弃…… 这是我想做的: 我想要 3 个 ScrollView (里面有 TextVie
我正在尝试开发类似于网格但使用 LinearLayout。我想在单行中有 3 张图像和图像后的确切底部文本。 我尝试过的: LinearLayout layout = new LinearLayout
我想在同一行添加一个 EditText 和一个 Button,我想将 80% 的行给 editText,20% 给 Button。 这是我的代码:
我有一个 mysql 表,其中存储一列(称为 tickets),并且 tickets 值可以是任意数字。 我想要做的是有一个mysql查询,从列中选择所有行,按降序对它们进行排序,然后使用PHP对查询
我搜索了一段时间,但结果让我很困惑,因为我对 MySQL 还很陌生。 我有一个包含这 4 列的表:AUTO_INCREMENT ID、NAME、TYPE、CHANCE 所以行看起来像这样: 1, NO
我不完全是 JS 专业人士,虽然不漂亮或高效,但这是有效的。 实际上,我在表单中有重复的字段组,并允许用户根据需要将数据从第一个字段复制到所有 5 个字段。 如何使这段代码更高效? function
我正在使用xgboost库来训练二元分类器。我想通过向权重添加噪声(例如集合中树的叶节点的值)来防止训练算法的数据泄漏。为此,我需要检索每棵树的权重并修改它们。 我可以通过在 Booster 对象上使
我正在尝试让 LinearLayout 中的 View 填充宽度。我尝试使用 LayoutParams 设置它,但它给了我一个错误: 我的代码: EditText et = new EditText(
我想改变 ScrollView 的权重,但找不到实现它的方法。 这是我的 XML: **other layout.. 从代码中只能设置scrollView的高度或者宽度,weigh
我是一名优秀的程序员,十分优秀!