how to export models?

jujujuju Member Posts: 39 Guru
edited November 2018 in Help

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.

 

Thanks-

 

Trivial sample code (for exmale these two models)

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<process version="6.4.000">
<context>
<input/>
<output/>
<macros/>
</context>
<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>
<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>
<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"/>
</process>
</operator>
</process>

 

Best Answer

  • Telcontar120Telcontar120 Moderator, RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 1,635 Unicorn
    Solution Accepted

    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 
    Data Science Consulting from Certified RapidMiner Experts

Answers

  • MartinLiebigMartinLiebig Administrator, Moderator, Employee, RapidMiner Certified Analyst, RapidMiner Certified Expert, University Professor Posts: 3,503 RM Data Scientist

    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.

     

    ~Martin

    - Sr. Director Data Solutions, Altair RapidMiner -
    Dortmund, Germany
  • jujujuju Member Posts: 39 Guru

    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!

     

  • Telcontar120Telcontar120 Moderator, RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 1,635 Unicorn

    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 
    Data Science Consulting from Certified RapidMiner Experts
  • roberto_suarezroberto_suarez Member Posts: 1 Contributor I

    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

  • CarlosQCarlosQ Member, University Professor Posts: 7 University Professor

    Hi Roberto:

     

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

     

    Regards,

     

    Carlos Q

  • wassdullullwassdullull Member Posts: 12 Contributor I

    Hi, i wanted to modify the apply model operator. I want to perform real time data mining and use the apply model to return an output.

     

  • MartinLiebigMartinLiebig Administrator, Moderator, Employee, RapidMiner Certified Analyst, RapidMiner Certified Expert, University Professor Posts: 3,503 RM Data Scientist

    Hi,

     

    why don't you use a RM Webservice and expose it as a webservice?

     

    Best,

    Martin

    - Sr. Director Data Solutions, Altair RapidMiner -
    Dortmund, Germany
Sign In or Register to comment.