Result of RapidMiner model -> input to Execute R Script
Hi Gurus,
I am new to rapidminer, I was able to implement a couple of R models(C5,rpart) in rapid miner successfully. Now I am trying to use the result of rapid miner model (Decision Tree) as input to R script , I am getting the below error :
"Incompatible data (Decision Tree) delivered at port input 1. The data delivered at the specified port was of the wrong type."
Unable to find a way to read the output of Rapidminer as input to R-script.
What I am trying to achieve:
1) I want to create a new field in the final output that explains in text how a data point was predicted as 0 or 1 (Binary -Decision Tree)
Example: if my model takes three variables a,b,c had the below conditions:
a>10
b<5 :1 {1=6,0=0}
c<5 :0 {1=0,0=3}
So in my final dataset it should have created a column for all 1's with text "a>10 & b<5" and all 0 as "C<5"
My Execute R script will have 2 inputs
1)Model (which has the conditions)
2)Test dataset+predictions (on which the text variable has to be created)
My final output should look like below
a b c Text (New column created after R script)
19 3 7 "a>10 & b<5"
5 8 3 "c<5"
Any help/tips would be greatly appreciated.
Best Answer
-
Hi,
while i see where you are coming from, this way to do it is kind of hard. The point is that a RM Decision Tree is a Java Object. This java object is hard to handle in a non-java language like R or Python. It's doable, but i would not recommend to do this.
If you want to do this you need to use Java or Groovy. Luckily i've built exactly the operator you want to have. It's part of Operator Toolbox (https://marketplace.rapidminer.com/UpdateServer/faces/product_details.xhtml?productId=rmx_operator_toolbox) and called Get DecisionTreePath. But you can also implement it yourself if you prefer this .
Best,
Martin
1
Answers
-
Hi,
while i see where you are coming from, this way to do it is kind of hard. The point is that a RM Decision Tree is a Java Object. This java object is hard to handle in a non-java language like R or Python. It's doable, but i would not recommend to do this.
If you want to do this you need to use Java or Groovy. Luckily i've built exactly the operator you want to have. It's part of Operator Toolbox (https://marketplace.rapidminer.com/UpdateServer/faces/product_details.xhtml?productId=rmx_operator_toolbox) and called Get DecisionTreePath. But you can also implement it yourself if you prefer this .
Best,
Martin
1