Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/67.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R会话中止,R使用bnlearn遇到致命错误_R_Fatal Error_Bnlearn - Fatal编程技术网

R会话中止,R使用bnlearn遇到致命错误

R会话中止,R使用bnlearn遇到致命错误,r,fatal-error,bnlearn,R,Fatal Error,Bnlearn,我正试图通过使用gs算法使用bnlearn进行结构学习。下面是一个reprex,其中第一个示例工作,输出“BP”“CO”“CCHL”作为报警数据集的马尔可夫覆盖层。第二个示例包含我的数据集的一个dput,它终止了我的R会话,如标题中所述。我已经在两个不同的环境中测试过了(一个是在全新的安装环境中),所以我不相信重置我的RStudio会解决这个问题(正如经常建议的那样) 我应该从这里去哪里 # Import library - if not already installed: install.p

我正试图通过使用gs算法使用bnlearn进行结构学习。下面是一个reprex,其中第一个示例工作,输出
“BP”“CO”“CCHL”
作为报警数据集的马尔可夫覆盖层。第二个示例包含我的数据集的一个dput,它终止了我的R会话,如标题中所述。我已经在两个不同的环境中测试过了(一个是在全新的安装环境中),所以我不相信重置我的RStudio会解决这个问题(正如经常建议的那样)

我应该从这里去哪里

# Import library - if not already installed: install.packages("bnlearn")
library("bnlearn")

# Working example of learning a markov blanket by GS ----
data("alarm")
data.info = bnlearn:::check.data(alarm, allow.missing = TRUE)
complete=data.info$complete.nodes
g<-bnlearn:::gs.markov.blanket(
  x="TPR",
  data=alarm,
  nodes=names(alarm),
  whitelist = NULL,
  blacklist = NULL,
  test="mi",
  alpha = 0.05,
  B=0L,
  complete=complete,
  max.sx = ncol(alarm)
)
g

# Broken example using a portion of my data ----
flexibo = structure(list(core1_status = structure(c(1L, 1L, 1L, 1L), .Label = c("0","1"), class = "factor"), core2_status = structure(c(1L, 1L, 1L, 1L), .Label = c("0", "1"), class = "factor"), core3_status = structure(c(1L, 1L, 1L, 1L), .Label = c("0", "1"), class = "factor"), core_freq = c(1113600, 1113600, 1113600, 1113600), gpu_freq = c(1300500000, 1300500000, 1300500000, 1300500000), emc_freq = c(1062400000, 1331200000, 1.6e+09, 1.866e+09), inference_time_tx2_inceptionv3_200x200 = c(0.225589222378201, 0.214755137761434, 0.207686079872979, 0.196737554338243), inference_time_tx2_inceptionv3_400x400 = c(0.24062548743354, 0.228842682308621, 0.216423908869425, 0.209609985351563), inference_time_tx2_inceptionv3_600x600 = c(0.396523714065552, 0.317007541656494, 0.31098911497328, 0.304014258914524), inference_time_tx2_inceptionv3_800x800 = c(0.638514121373495, 0.576082282596164, 0.525318622589111, 0.489617533153958), inference_time_tx2_xception_200x200 = c(0.181074645784166, 0.164963987138536, 0.175967693328857, 0.150462971793281), inference_time_tx2_xception_400x400 = c(0.260576195187039, 0.230662610795763, 0.209879769219293, 0.20272265540229), inference_time_tx2_xception_600x600 = c(0.538474798202515, 0.476561334398058, 0.452916807598538, 0.438972314198812), inference_time_tx2_xception_800x800 = c(0.938906934526232, 0.82663533422682, 0.791404538684421, 0.755376815795898)), row.names = c(NA, 4L), class = "data.frame")

# Grow Shrink (GS) crashes R with flexibo 
flexibo.info = bnlearn:::check.data(flexibo, allow.missing = TRUE)
g<-bnlearn:::gs.markov.blanket(
  x="TPR",
  data=flexibo,
  nodes=names(flexibo),
  whitelist = NULL,
  blacklist = NULL,
  test="mi",
  alpha = 0.05,
  B=0L,
  complete=flexibo.info$complete.nodes,
  max.sx = ncol(flexibo)
)
#导入库-如果尚未安装:install.packages(“bnlearn”)
图书馆(“bnlearn”)
#用GS学习markov毯的工作实例----
数据(“报警”)
data.info=bnlearn:::check.data(报警,allow.missing=TRUE)
complete=data.info$complete.nodes
gYou的数据是混合的——离散的和数字的——因此条件测试需要是
“mi cg”
(条件高斯)。由于您使用的是非返回的低级函数,很可能您跳过了可能会导致此问题的检查,因此低级函数传递了不正确的参数,并导致系统出错。这是使用这种低级函数的危险之一。(您还有
x=“TPR”
,但这可能只是一个转录错误)