planarPlot-methods(MLInterfaces)
planarPlot-methods()所属R语言包:MLInterfaces
Methods for Function planarPlot in Package ‘MLInterfaces’
功能planarPlot方法包MLInterfaces
译者:生物统计家园网 机器人LoveR
描述----------Description----------
show the classification boundaries on the plane dictated by two genes in an ExpressionSet
表明在飞机上的分类边界由两个基因决定1 ExpressionSet
方法----------Methods----------
clo = "classifierOutput", eset = "ExpressionSet", classifLab = "character" uses two genes in the ExpressionSet
CLO =“classifierOutput”,ESET“ExpressionSet”,classifLab =“字符”在ExpressionSet使用的两个基因
clo = "classifierOutput", eset = "data.frame", classifLab = "character" uses two columns in the data.frame
CLO =“classifierOutput”,ESET =“数据框”,classifLab =“字符”使用两列中的数据框
举例----------Examples----------
library(ALL)
library(hgu95av2.db)
data(ALL)
#[]
# restrict to BCR/ABL or NEG[限制BCR / ABL的或负]
#[]
bio <- which( ALL$mol.biol %in% c("BCR/ABL", "NEG"))
#[]
# restrict to B-cell[限制B单元]
#[]
isb <- grep("^B", as.character(ALL$BT))
kp <- intersect(bio,isb)
all2 <- ALL[,kp]
#[]
# sample 2 genes at random[样品2基因随机]
#[]
set.seed(1234)
ng <- nrow(exprs(all2))
pick <- sample(1:ng, size=2, replace=FALSE)
gg <- all2[pick,]
sym <- unlist(mget(featureNames(gg), hgu95av2SYMBOL))
featureNames(gg) <- sym
gg$class = factor(ifelse(all2$mol.biol=="NEG", "NEG", "POS"))
cl1 <- which( gg$class == "NEG" )
cl2 <- which( gg$class != "NEG" )
#[]
# create balanced training sample[建立平衡的训练样本]
#[]
trainInds <- c( sample(cl1, size=floor(length(cl1)/2) ),
sample(cl2, size=floor(length(cl2)/2)) )
#[]
# run rpart[运行软件rpart]
#[]
tgg <- MLearn(class~., gg, rpartI, trainInds, minsplit=4 )
opar <- par(no.readonly=TRUE)
par(mfrow=c(2,2))
planarPlot( tgg, gg, "class" )
title("rpart")
points(exprs(gg)[1,trainInds], exprs(gg)[2,trainInds], col=ifelse(gg$class[trainInds]=="NEG", "yellow", "black"), pch=16)
#[]
# run nnet[运行nnet]
#[]
ngg <- MLearn( class~., gg, nnetI, trainInds, size=8 )
planarPlot( ngg, gg, "class" )
points(exprs(gg)[1,trainInds], exprs(gg)[2,trainInds], col=ifelse(gg$class[trainInds]=="NEG", "yellow", "black"), pch=16)
title("nnet")
#[]
# run knn[运行KNN]
#[]
kgg <- MLearn( class~., gg, knnI(k=3,l=1), trainInds)
planarPlot( kgg, gg, "class" )
points(exprs(gg)[1,trainInds], exprs(gg)[2,trainInds], col=ifelse(gg$class[trainInds]=="NEG", "yellow", "black"), pch=16)
title("3-nn")
#[]
# run svm[运行SVM]
#[]
sgg <- MLearn( class~., gg, svmI, trainInds )
planarPlot( sgg, gg, "class" )
points(exprs(gg)[1,trainInds], exprs(gg)[2,trainInds], col=ifelse(gg$class[trainInds]=="NEG", "yellow", "black"), pch=16)
title("svm")
par(opar)
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|