查看http://www.bnlearn.com/documentation/man/arcops.html,掉落弧的方法是使用drop.arcs
函数。
它似乎并没有放下它
library(bnlearn)
data(learning.test)
res = gs(learning.test)
arcs(res)
from to
[1,] "A" "B"
[2,] "A" "D"
[3,] "B" "A"
[4,] "B" "E"
[5,] "C" "D"
[6,] "F" "E"
drop.arc(res, "A", "B")
arcs(res)
from to
[1,] "A" "B"
[2,] "A" "D"
[3,] "B" "A"
[4,] "B" "E"
[5,] "C" "D"
[6,] "F" "E"
但是在调试日志中似乎有效。
drop.arc(res, "A","B",debug=T)
* dropping any arc between A and B .
> dropping any arc between A and B .
* (re)building cached information about node A.
* node A.
> found child D.
> found node C in markov blanket.
> node A has 0 parent(s), 1 child(ren), 1 neighbour(s) and 2 nodes in the markov blanket.
...
这是R3.4.3
的问题吗?检查周期时如何使用ARC操作?我总是可以替换res$arcs
表,但我希望能够检查周期。
> version
_
platform x86_64-apple-darwin15.6.0
arch x86_64
os darwin15.6.0
system x86_64, darwin15.6.0
status
major 3
minor 4.3
year 2017
month 11
day 30
svn rev 73796
language R
version.string R version 3.4.3 (2017-11-30)
nickname Kite-Eating Tree
> packageVersion('bnlearn')
[1] '4.3'
?drop.arcs
的帮助页面说
;所有功能都不可见地返回x。
的更新副本
您必须将函数调用的结果分配给对象。所以尝试
res2 = drop.arc(res, "A", "B")
arcs(res2)