planarPlot-methods       package:MLInterfaces       R Documentation

_M_e_t_h_o_d_s _f_o_r _F_u_n_c_t_i_o_n _p_l_a_n_a_r_P_l_o_t _i_n _P_a_c_k_a_g_e '_M_L_I_n_t_e_r_f_a_c_e_s'

_D_e_s_c_r_i_p_t_i_o_n:

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

_M_e_t_h_o_d_s:

     _c_l_o = "_c_l_a_s_s_i_f_O_u_t_p_u_t", _e_s_e_t = "_e_x_p_r_S_e_t", _c_l_a_s_s_i_f_L_a_b = "_c_h_a_r_a_c_t_e_r" ~~des
          cribe this method here 

_E_x_a_m_p_l_e_s:

     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(geneNames(gg), hgu95av2SYMBOL))
     geneNames(gg) <- sym
     class <- as.character(all2$mol.biol)
     gg@phenoData@pData$class <- factor(class)
     cl1 <- which( class == "NEG" )
     cl2 <- which( 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")
     #
     # run nnet
     #
     ngg <- nnetB( gg, "class", trainInds, size=8 )
     planarPlot( ngg, gg, "class" )
     title("nnet")
     #
     # run knn
     #
     kgg <- knnB( gg, "class", trainInds, k=3, l=1 )
     planarPlot( kgg, gg, "class" )
     title("3-nn")
     #
     # run svm
     #
     sgg <- svmB( gg, "class", trainInds )
     planarPlot( sgg, gg, "class" )
     title("svm")
     par(opar)

