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.
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.