[BioC] Diagonal LDA in MLInterfaces

Martin Morgan mtmorgan at fhcrc.org
Thu Sep 21 07:05:47 CEST 2006

If you are still looking for a way to do this, I think what you need
to do is (a) define a generic function and then (b) define a method on
that function that serves as a 'wrapper' to the original call. Taking
as an example the ipredInterfaces.R source code that comes with
MLInterfaces, and trying to extract the relevant bits for diagDA:

           function(exprObj, classifLab, trainInd, ...) {

The three arguments 'exprObj', 'classifLab', and 'trainInd' are used
and therefore required by the MLInterfaces machinery. The '...' allow
other arguments to be given to the function, and used in a method such

          c("ExpressionSet", "character", "integer"),
          function(exprObj, classifLab, trainInd,
                   pool = TRUE, ...) {

              ## the code in this method is only executed when the
              ## first argument to diagDAB is an ExpressionSet, the
              ## second a character vector, and the third an integer
              ## vector. The names suggest what their role is. 'pool'
              ## is just an example variable that you might want to
              ## add to the method signature to 'pick out' arguments
              ## the user might provide and that you want to use in
              ## the method. You will have to write code to massage
              ## the arguments so that they can be used by diagDA, and
              ## then call diagDA -- I'm not exactly sure what that
              ## code looks like, but you'll end up with a line

              ans <- diagDA(ls, cll, ts, pool=pool, ...)

              ## ans will be the result of the diagDA call, and you'll
              ## now have to write code to massage the answer you have
              ## obtained in such a way that you can create and return
              ## a 'classifOutput' object, eventually making a call
              ## like... 

              new("classifOutput", method="diagDA",
                  trainInds=trainInd, allClass=as.character(pData(exprObj)[[classifLab]]),
                  RObject=ans, call=match.call(), distMat=dis)

At least two caveats: (1) I have not actually tried this, and (2)
MLInterfaces is using setGeneric and setMethod in ways that are quite
different from how they are normally used -- nothing wrong with that,
of course, but be prepared!

Hope that helps,


"Christos Hatzis" <christos at nuverabio.com> writes:

> Hi,
> Does anyone know whether diagonal linear discriminant analysis (DLDA) is
> supported through the unified MLInterfaces? I have been working with diagDA
> from sfsmisc, but would like to use the xval and other methods supported by
> MLInterfaces.  Is there a simple way to extend the package to include
> support for a new classification algorithm?
> Thank you. 
> Christos Hatzis, Ph.D.
> Nuvera Biosciences, Inc.
> 400 West Cummings Park
> Suite 5350
> Woburn, MA 01801
> Tel: 781-938-3830
> www.nuverabio.com <http://www.nuverabio.com/>
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor

Martin T. Morgan
Bioconductor / Computational Biology

More information about the Bioconductor mailing list