0

I'm receiving an error when trying to export one of my 'regression' randomForest models to PMML.

The code I'm using to generate the model looks something like this:

model <- foreach(ntree = rep(100, 10), .combine = combine, .multicombine=TRUE, .packages = "randomForest") %dopar%
    randomForest(train[, variables], y=train[["logprice"]], ntree=ntree)
model

I'm then trying to save the model with

pmml(model, model.name="myFirstPMML_Model", app.name="PMML", data=train)

The error message I then receive is

Error in names(field$class) <- var.names: attempt to set an attribute on NULL

Any hints/solutions would be much appreciated.

herrherr
  • 708
  • 1
  • 9
  • 26
  • It would be helpful if you could supply a [reproducible example](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) that is minimally sufficient to reproduce your problem. I'm assuming model is a list of randomForest models? Are you sure `pmml` accepts a list? – MrFlick Aug 02 '14 at 19:19

1 Answers1

3

In general, the pmml function expects a R object and so will not work on a list of such objects; you would have to apply it element by element. In this case, the error comes from the fact that in the present release, the pmml function expects the randomForest object to be made using a formula....not using input matrices. I plan on adding this new feature on the next release, but in the meantime you would have to access the input data using the formula interface.

Tridi
  • 186
  • 2