[R] pmml for random forest & rules

Graham Williams Graham.Williams at togaware.com
Tue Oct 11 13:10:25 CEST 2011


Hi Patrick,

Thanks for the detailed report. See comments below.

On 11 October 2011 05:57, Patrick McCann <patmmccann at gmail.com> wrote:
[...]
> I am having some trouble using R 2.13.1 for generating a pmml object
> of class "c('randomForest.formula', 'randomForest')"
[...]
> Random Forest (and randomSurvivalForest)
> — randomForest (Breiman and Cutler. R
> port by A. Liaw and M. Wiener, 2009) and randomSurvivalForest
> (Ishwaran and Kogalur ,
> 2009): PMML export of a randomSurvivalForest "rsf" object. This
> function gives the user
> the ability to export PMML containing the geometry of a forest.
[...]
> Error in UseMethod("pmml") :
>  no applicable method for 'pmml' applied to an object of class
> "c('randomForest.formula', 'randomForest')"

Sorry for the ambiguity there. It tries to say in the paper that "pmml" supports
"PMML export of a randomSurvivalForest "rsf" object". It mentions
randomForest but does not say it can export randomForest. There is
some experimental code for pmml.randomForest but it has not yet
been completed.

> Also, if I run these lines of code
> data("Adult")
> ## Mine association rules.
> rules <- apriori(Adult,
>                 parameter = list(supp = 0.5, conf = 0.9,
>                                  target = "rules"))
>  pmml(rules)
>
>
> I get this error:
>> pmml(rules)
> Error in function (classes, fdef, mtable)  :
>  unable to find an inherited method for function "size", for
> signature "itemMatrix"
[...]
>   standardGeneric("size"), <environment>)
> 3: size(is.unique)
> 2: pmml.rules(rules)
> 1: pmml(rules)

That's odd. Not quite sure yet what is causing that. On my system it
works just fine:

> library(pmml)
> library(arules)
> data(Adult)
> rules <- apriori(Adult,
                parameter = list(supp = 0.5, conf = 0.9,
                                 target = "rules"))
> pmml(rules)
<PMML version="3.2" ...>
 <Header copyright="Copyright (c) 2011 gjw"...>
 <Extension name="user" value="gjw" extender="Rattle/PMML"/>
 <Application name="Rattle/PMML" version="1.2.27"/>
 <Timestamp>2011-10-11 21:50:40</Timestamp>
 </Header>
[...]

My system:

> rattleInfo()
Rattle: version 2.6.11 cran 2.6.11
R: version 2.13.2 (2011-09-30) (Revision 57111)

Sysname: Linux
Release: 2.6.38-12-generic
Version: #51-Ubuntu SMP Wed Sep 28 14:27:32 UTC 2011
[...]
pmml: version 1.2.27
[...]
arules: version 1.0-6

I'm using R 2.13.2 - could that be an issue - you have 2.13.1?

Regards,
Graham



More information about the R-help mailing list