Contributor II juju
Contributor II

how to export models?

Hi, I would like to export models in RM, and later see in other softwares. Is there a way to do it?


So the basic thing I'm thinking of is to export the text/table part in the model, a further thing is to save the tree strucutre in a tree model.




Trivial sample code (for exmale these two models)

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<process version="6.4.000">
  <operator activated="true" class="process" compatibility="6.0.002" expanded="true" name="Process">
    <process expanded="true">
      <operator activated="true" class="generate_data" compatibility="6.4.000" expanded="true" height="60" name="Generate Data" width="90" x="45" y="30">
        <parameter key="target_function" value="polynomial classification"/>
      <operator activated="true" class="multiply" compatibility="6.4.000" expanded="true" height="94" name="Multiply" width="90" x="179" y="30"/>
      <operator activated="true" class="support_vector_machine_libsvm" compatibility="6.4.000" expanded="true" height="76" name="SVM" width="90" x="380" y="30">
        <list key="class_weights"/>
      <operator activated="true" class="parallel_decision_tree" compatibility="6.4.000" expanded="true" height="76" name="Decision Tree" width="90" x="380" y="165"/>
      <connect from_op="Generate Data" from_port="output" to_op="Multiply" to_port="input"/>
      <connect from_op="Multiply" from_port="output 1" to_op="SVM" to_port="training set"/>
      <connect from_op="Multiply" from_port="output 2" to_op="Decision Tree" to_port="training set"/>
      <connect from_op="SVM" from_port="model" to_port="result 1"/>
      <connect from_op="Decision Tree" from_port="model" to_port="result 2"/>
      <portSpacing port="source_input 1" spacing="0"/>
      <portSpacing port="sink_result 1" spacing="0"/>
      <portSpacing port="sink_result 2" spacing="0"/>
      <portSpacing port="sink_result 3" spacing="0"/>


RM Certified Expert
RM Certified Expert

Re: how to export models?

Unfortunately it generally isn't easy to move models from one type of analytics software to another.  You have a couple of options, although you won't be able to export every kind of model easily.  What other software in particular are you thinking of?


First, there is a "Write PMML" operator which supports some standard types of models but not all.  Also, not all software is equipped to read PMML models, so it may or may not help you.


For simple models like linear or logistic regression, it's not too cumbersome to code the models manually.  For decision trees, there is an operator "Tree to Rules" which represents all the splits of the trees in a rule form that can also be exported as text and then converted manually into formats like SQL.


Of course, the beauty of RapidMiner is that it is designed to be able to handle scoring in production environments, which would eliminate the need to represent the model in some other software.  So you also may want to explore whether you can just use RapidMiner to do not only the modeling work but also the ongoing scoring of records as needed.

Brian T., Lindon Ventures - www.lindonventures.com
Analytics Consulting by Certified RapidMiner Analysts
RM Staff
RM Staff

Re: how to export models?

To add another line of thought to Brian's post.


The open source nature of RapidMiner of course allows to use RM classes in other software. This means you can use the binary java object in your java project. Please keep licensing in mind.



Head of Data Science Services at RapidMiner
Contributor II juju
Contributor II

Re: how to export models?

Thank you Brian and Martin~


Brian, what do you mean by "code the models manually"?


I would like to access the text and table in the models, w/ R or Qlik.


Let me know please. Thank you so much!


RM Certified Expert
RM Certified Expert

Re: how to export models?

I mean that in the case of linear or logistic regression, you have a set of coefficients that correspond to your predictor variables, and they can be represented as a linear equation (transformed in the case of logistic regression).  There are usually a manageable number of predictors in these models so you can simply write that function out manually and implement it in R, for example.  But you don't want to try this with neural networks or SVMs!


By the way, if you are interested in working with R in RapidMiner, you should also check out the R scripting extension, which allows inclusion of R code directly in the RapidMiner environment, and the passing of data back and forth between the two.  If you are using Qlik, you can output such as scores from RapidMiner into a format that is easily read by Qlik.  I'm not sure why you would want to do the actual scoring in Qlik, though.

Brian T., Lindon Ventures - www.lindonventures.com
Analytics Consulting by Certified RapidMiner Analysts
Learner I roberto_suarez
Learner I

Re: how to export models?

Hi Brian!


I've looking for the operator you mentioned ("Write PMML" ) in my RM 7.5.003 but i don´t see it. Have they renamed it or do I have to download another extension?


Greetings from Costa Rica

Learner III CarlosQ
Learner III

Re: how to export models?

Hi Roberto:


You have install the PMML extension. Go to Extension, Market Place, ... and look for PMML.




Carlos Q

How can RapidMiner increase participation in our new competitions?
Twitter Feed