community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.

Random Forest model output - MSE available?

Highlighted

Hello all, 

 

I am trying to extract data from the model output of various predictive tools, but mainly Random Forest. 

After learning a bit of R, I can extract the IncNodePurity using the 'importance' call like so:

 

model.data <- read.Alteryx("#1")
the_obj <- unserializeObject(as.character(model.data$Object[1]))

the_summary <- summary(the_obj)
the_importance <- importance(the_obj)

write.Alteryx(as.data.frame(the_summary), 1, TRUE)
write.Alteryx(as.data.frame(the_importance), 2, TRUE)

Importance gives the Node Purity but MSE is more accurate and I would prefer to output this instead. Only, I can't find a reliable way to call %IncMSE from the R tool. Does anyone know how to extract this, and more generally is there a place with comprehensive documentation of these? The 'Tool Mastery' pages are not detailed enough!

 

As a side note, It seems bizarre that the tools would output PNG of the data in the Reports but have a not have a formatted, tabular output as well. It would certainly save me some time. Is this in the pipeline?

Alteryx
Alteryx

Hello @samstafford,

 

Since the Forest Model tool uses the RandomForest package, it might be a good idea to check out the documentation for that package: randomForest

Random Forest Package.png

 

As for pulling the %IncMSE, here are a few articles that may help you further develop your custom code:

https://stackoverflow.com/questions/27918320/what-does-negative-incmse-in-randomforest-package-mean - importance(rf,type=1)

https://stats.stackexchange.com/questions/162465/in-a-random-forest-is-larger-incmse-better-or-worse

https://www.quora.com/How-do-we-calculate-variable-importance-for-a-regression-tree-in-random-forest...

 

Also, if you think it would be a valuable feature for the predictive tools to output Reports as a data stream, here is a post on our ideas page that you can star/comment on:

https://community.alteryx.com/t5/Alteryx-Designer-Ideas/Output-Predictive-Report-Tables-as-Data-Stre...

 

Hoss Carroll
Customer Support Engineer
Alteryx

Hello Hoss,

 

Thanks for your suggestions.

After looking through the documentation for randomForest and the stackexchange posts I am still unable to extract the values. Your sources explicitly say that IncMSE and IncNodePurity are both returned when calling rf$importance or importance(rf), but Alteryx using the R tool only returns IncNodePurity. It's almost as if Alteryx is using a non-standard randomForest package?

 

For the record the output says I'm using randomForest 4.6-14

Alteryx Certified Partner
Alteryx Certified Partner

You could try using the model comparison tool, which is available on the gallery.

 

https://gallery.alteryx.com/#!app/Model-Comparison/56bbd3013df7da08b8fcd00a

 

The purpose of the tool is to compare the output of multiple models, but it can be used for just a single model too, it will return the RMSE, MAE, MPE and MAPE values.

 

https://help.alteryx.com/2018.2/Model_Comparison.htm

 

Ben

Labels