cancel
Showing results for 
Search instead for 
Did you mean: 

R-CNR Tree function is not working

venkataramana_paidi
Contributor
0 Kudos

Hi ,

I am using the SAP Predictive Analytics 3.1.1. I am trying to run the classification analysis with Decision Trees using R-CNR Tree algorithm. While executing the algorithm , I am getting the error like ERROR_FROM_R. I have installed necessary library for this analysis like lme4 but still it is giving the problem.

I have executed the cluster analysis and Association analysis and they are working fine.

Please find the below screenshot for reference.

3.png 2.png1.png

Please let me know why this algorithm is not working?

Thanks & Regards,

Ramana.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member

Hi Axel,
The warning message "package ‘arules’ is not available (for R version 3.3.0)" is not related to this other issue of "R-CNR Tree: ERROR_FROM_R". It simply means that 'arules' package isn't available for the R version you have on your machine, which is '3.3.0'.

If you are still getting R-CNR Tree: ERROR_FROM_R when using SAP Predictive Analytics 3.1.1 there are some steps you can take to troubleshoot:
1) Go to SAP Predictive Analytics 3.1.1 logging folder (at %temp%\sappa\logs )
2) Open the newest TraceLog file there ( e.g. TraceLog_12188_2017_05_12_10_09_40_701_trace.log )
At the end of the file there is probably a stack trace such as:
2017/05/12 16:25:42.621000|>>|S| |29924| 43| |||||||||||||||[com.sap.hilo.desktop.predict.services.ExecuteChainService]
com.sap.pa.papd.connector.exception.ServiceConnectorException: ERROR_FROM_R
at com.sap.pa.papd.connector.ServiceInprocConnector.executeRequest(ServiceInprocConnector.java:231)...
3) Look above this in the logs for some R related logging such as:
RCommand: -------- capture.output(caret::varImp(cnr_model))
4) In the case of an error from R, entries like this will be logged:
2017/05/12 16:25:42.596000|>>|E| |29924| 43| |||||||||||||||[com.sap.pa.components.algorithms.R.generic.RCommandExecutor]Command returned Error from R: Error in 1:nrow(object$splits) : argument of length 0
5) In this particular case, "argument of length 0" suggests to me that there is an issue with the arguments R was using in the calculation. I confirmed this by re-configuring the R-CNR Tree to use some additional features in the calculation. I executed the algorithm again and it worked. I had simply not supplied enough features (arguments) for R-CNR Tree to work for this dataset.
N.B.) Note that the steps to resolve an Error from R are highly dependent on what you are seeing in the logs. E.g. if the error from R is due to missing package then you should try an appropriate resolution such as installing the missing package.


@Ramana. would you try this please? For the census01 dataset you were using, in SAP Predictive Analytics 3.1.1 would you configure R-CNR Tree to use "Age", "Workclass", "FNLWGT", "Education" and "Educationnum" as Features, with "Class" as Target Variable? Please also ensure you have specified "Classification" as Algorithm Type for this combination of variables, as you are trying to classify to a target of "Class". Then try to Execute the chain again and let me know if this works now without the ERROR_FROM_R? I believe you possibly hadn't selected enough features at the time, so let's see if that fixes this for you.

Kind regards, Simon

Answers (4)

Answers (4)

Axel1
Newcomer
0 Kudos

Hello I get the error:

Cause: R-CNR Tree: ERROR_FROM_R

I set the JAVA_HOME variable and did the manual installation after the istallation from PA but still the same error for decision trees?

Installing:

install.packages("arules", dependencies=T, lib="C:/Users/Public/R-3.3.0/library")

prduced following messge:

Warning message:

package ‘arules’ is not available (for R version 3.3.0)

is arules the decision tree function?

achab
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

Sorry for the late answer.

Can you please refer to this.

"Running library(rJava)in R studio or RGUI should reveal more details about the error. I suspect Java isn’t configured correctly on the machine and at least JRE needs to be installed and the JAVA_HOME should be correctly set. Something like JAVA_HOME=C:\Program Files\Java\jre1.n.n_xx"

Kind regards

Antoine

venkataramana_paidi
Contributor
0 Kudos

Hi Antoine,

I have R 3.3.0 in my system and I followed the below SAP note:

2409635 - How to manually install and configure R using Expert Analytics?

Except this algorithm remaining algorithms are working from the OpenSAP course.

Is any other reason or any other package need to install?

Thanks & Regards,

Ramana.

achab
Product and Topic Expert
Product and Topic Expert
0 Kudos

Can you please refer here (assuming you are part of our openSAP course)? The discussion has the latest information. https://open.sap.com/courses/ds1/question/1e02a34e-27f7-4275-975f-5ec5c15fae1a

[Amit]

Hi All,

The content of the note suggest below steps: Please follow the below steps to manually install R.

  1. Step 1: Exit EA and install R 3.2.5 manually into %public%\R-3.2.5 as your target. Assuming %public% goes to C:\Users\Public\
  2. Step 2: Goto C:\Users\Public\R-3.2.5\bin\x64 and launch Rgui.exe
  3. Step 3: Copy and paste the following commands to get all the necessary packages: setInternet2(T) install.packages("rJava", dependencies=T, lib="C:/Users/Public/R-3.2.5/library") install.packages("RODBC", dependencies=T, lib="C:/Users/Public/R-3.2.5/library") install.packages("RJDBC", dependencies=T, lib="C:/Users/Public/R-3.2.5/library") install.packages("DBI", dependencies=T, lib="C:/Users/Public/R-3.2.5/library") install.packages("monmlp", dependencies=T, lib="C:/Users/Public/R-3.2.5/library") install.packages("AMORE", dependencies=T, lib="C:/Users/Public/R-3.2.5/library") install.packages("pmml", dependencies=T, lib="C:/Users/Public/R-3.2.5/library") install.packages("XML", dependencies=T, lib="C:/Users/Public/R-3.2.5/library") install.packages("arules", dependencies=T, lib="C:/Users/Public/R-3.2.5/library") install.packages("caret", dependencies=T, lib="C:/Users/Public/R-3.2.5/library") install.packages("reshape", dependencies=T, lib="C:/Users/Public/R-3.2.5/library") install.packages("plyr", dependencies=T, lib="C:/Users/Public/R-3.2.5/library") install.packages("foreach", dependencies=T, lib="C:/Users/Public/R-3.2.5/library") install.packages("iterators", dependencies=T, lib="C:/Users/Public/R-3.2.5/library") install.packages("adabag", dependencies=T, lib="C:/Users/Public/R-3.2.5/library") install.packages("ggplot2", dependencies=T, lib="C:/Users/Public/R-3.2.5/library") install.packages("reshape2", dependencies=T, lib="C:/Users/Public/R-3.2.5/library") install.packages("nnet", dependencies=T, lib="C:/Users/Public/R-3.2.5/library") install.packages("rpart", dependencies=T, lib="C:/Users/Public/R-3.2.5/library") install.pacakges("randomForest", dependencies=T, lib="C:/Users/Public/R-3.2.5/library")  
  4. Step 4: From within Expert Analytics: Go to the menu: File --> Install and Configure R Ensure checkbox for 'Enable open source R algorithms" is selected and the folder specified is C:\Users\Public\R-3.2.5 as defined above.

Please note important change which you need to watch out: if you are trying the manual workaround, you should specify the version of R installed through EA in the path for packages. If you are running PA3.1, version of R installed by EA will be R-3.3.0 and the path should be set accordingly, for e.g. install.packages(“rJava”, dependencies=T, lib=”C:/Users/Public/R-3.3.0/library”) and not R-3.2.5 Hope this helps. Best Regards, Amit

[Antoine]

Running library(rJava)in R studio or RGUI should reveal more details about the error. I suspect Java isn’t configured correctly on the machine and at least JRE needs to be installed and the JAVA_HOME should be correctly set. Something like JAVA_HOME=C:\Program Files\Java\jre1.n.n_xx

Also, if you are installing R outside of Expert Analytics, you should specify the version of R installed through Expert Analytics in the path for packages. If youare running PA3.1, version of R installed by EA will be R-3.3.0 and the path should be set accordingly, for e.g. install.packages("rJava", dependencies=T, lib="C:/Users/Public/R-3.3.0/library") and not R-3.2.5 as in the KBA