BookmarkSubscribeRSS Feed
statman123
Calcite | Level 5

Hi

 

I would like to get R syntax to put in the open source code in EM for the following models to compare

 

Decision Tree

Reg

Neural Net

 

Also the packages and libraries needed

 

thanks!

5 REPLIES 5
MelodieRush
SAS Employee

Here is basic code for using the open source integration node for a decision tree in R. I use this code all the time 🙂

 

library(rpart)
&EMR_MODEL <- rpart(
&EMR_CLASS_TARGET ~ &EMR_CLASS_INPUT + &EMR_NUM_INPUT, data=&EMR_IMPORT_DATA,method ="class")

Catch the SAS Global Forum keynotes, announcements, and tech content!
sasglobalforum.com | #SASGF



MelodieRush
SAS Employee

Here is basic code for doing a logistic regression in R using the open source node in EM.

 

&EMR_MODEL <- glm(&EMR_CLASS_TARGET ~ &EMR_CLASS_INPUT + &EMR_NUM_INPUT,
                                     family=binomial(), data=&EMR_IMPORT_DATA)

Catch the SAS Global Forum keynotes, announcements, and tech content!
sasglobalforum.com | #SASGF



MelodieRush
SAS Employee

Basic code for Random Forest in R using the Open Source Node in EM.

 

#load library
library(randomForest)

 

#train model
&EMR_MODEL <- randomForest(&EMR_CLASS_TARGET ~ &EMR_CLASS_INPUT + &EMR_NUM_INPUT, ntree=100, mtry=5, data=&EMR_IMPORT_DATA, importance=TRUE)

Catch the SAS Global Forum keynotes, announcements, and tech content!
sasglobalforum.com | #SASGF



MelodieRush
SAS Employee

Basic code for neural networks in R using the Open Source node in EM.

 

library(nnet)
&EMR_MODEL <- nnet(&EMR_CLASS_TARGET ~ &EMR_CLASS_INPUT + &EMR_NUM_INPUT, size=2, rang=0.1, data=&EMR_IMPORT_DATA)

Catch the SAS Global Forum keynotes, announcements, and tech content!
sasglobalforum.com | #SASGF



MelodieRush
SAS Employee
Keep in mind the recommended version of R.
(taken from EM help)

R Configuration

Typically, R is installed on the same machine as the SAS Enterprise Miner Server. The Open Source Integration node is verified to work with 64-bit R 3.12, the pmml 1.4.2 package, and the XML 3.98-1.1 package. It is not recommended that you use 32-Bit R because SAS Enterprise Miner data sources often require large allocations of memory.

Catch the SAS Global Forum keynotes, announcements, and tech content!
sasglobalforum.com | #SASGF



SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to choose a machine learning algorithm

Use this tutorial as a handy guide to weigh the pros and cons of these commonly used machine learning algorithms.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 5 replies
  • 1392 views
  • 0 likes
  • 2 in conversation