# # # R代码从装饰图案的iterativeBMA来源。Rnw“# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #代码块1号:设置# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #库(“Biobase”)库(BMA)库(iterativeBMA) # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #代码块2号:getTrainData # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #使用样本训练数据。它ExpressionSet}{\叫做trainData。数据(trainData) # #类向量(0,1)trainClass数据(trainClass) # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #代码块3号:trainingStep # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #训练阶段:选择ret.bic相关基因。全球语言监测机构< - iterateBMAglm。火车(train.expr。设置= trainData ret.bic trainClass, p = 100)。全球语言监测机构美元namesx ret.bic。glm probne0 # #美元获得所选基因probne0 > 0 ret.gene.names < - ret.bic.glm $ namesx [ret.bic。glm $ probne0 > 0] ret.gene.names # # ret.bic得到的后验概率选择模型。glm美元postprob # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #代码块数量4:testStep # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #测试ExpressionSet叫做testData。数据(testData) # #获得测试数据的子集和bic的最后一次迭代的基因。全球语言监测机构curr.test。dat < - t (exprs (testData) [ret.gene.names,]) # #计算测试样本的预测概率y.pred。测试< -应用(curr.test。bma dat, 1日。预测,postprobArr = ret.bic。glm$postprob, mleArr=ret.bic.glm$mle) ## compute the Brier Score if the class labels of the test samples are known data (testClass) brier.score (y.pred.test, testClass) ################################################### ### code chunk number 5: trainPredictStep ################################################### ## train and predict ret.vec <- iterateBMAglm.train.predict (train.expr.set=trainData, test.expr.set=testData, trainClass, p=100) ## compute the Brier Score data (testClass) brier.score (ret.vec, testClass) ################################################### ### code chunk number 6: trainPredictTestStep ################################################### iterateBMAglm.train.predict.test (train.expr.set=trainData, test.expr.set=testData, trainClass, testClass, p=100) ################################################### ### code chunk number 7: imageplot ################################################### imageplot.iterate.bma (ret.bic.glm)