planarPlot-methods {MLInterfaces} | R Documentation

## Methods for Function planarPlot in Package ‘MLInterfaces’

### Description

show the classification boundaries on the plane dictated by two genes in an ExpressionSet

### Methods

clo = "classifOutput", eset = "ExpressionSet", classifLab = "character"
  uses two genes in the ExpressionSet to exhibit the decision boundaries in the plane
clo = "classifOutput", eset = "data.frame", classifLab = "character"
  uses two columns in the data.frame to exhibit the decision boundaries in the plane

### Examples

    library(ALL)
    data(ALL)
    #
    # restrict to BCR/ABL or NEG
    #
    bio <- which( ALL$mol.biol %in% c("BCR/ABL", "NEG"))
    #
    # restrict to B-cell
    #
    isb <- grep("^B", as.character(ALL$BT))
    kp <- intersect(bio,isb)
    all2 <- ALL[,kp]
    #
    # sample 2 genes at random
    #
    set.seed(1234)
    ng <- nrow(exprs(all2))
    pick <- sample(1:ng, size=2, replace=FALSE)
    library(hgu95av2)
    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
    #
    tgg <- rpartB( gg, "class", 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
    #
    ngg <- nnetB( gg, "class", 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
    #
    kgg <- knnB( gg, "class", trainInds, k=3, l=1 )
    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
    #
    sgg <- svmB( gg, "class", 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)

[Package MLInterfaces version 1.12.0 Index]