how to export models?

juju
juju New Altair Community Member
edited November 2024 in Community Q&A

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>

 

Tagged:

Best Answer

  • Telcontar120
    Telcontar120 New Altair Community Member
    Answer ✓

    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.

Answers

  • Telcontar120
    Telcontar120 New Altair Community Member
    Answer ✓

    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.

  • MartinLiebig
    MartinLiebig
    Altair Employee

    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

  • juju
    juju New Altair Community Member

    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!

     

  • Telcontar120
    Telcontar120 New Altair Community Member

    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.

  • roberto_suarez
    roberto_suarez New Altair Community Member

    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

  • CarlosQ
    CarlosQ New Altair Community Member

    Hi Roberto:

     

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

     

    Regards,

     

    Carlos Q

  • wassdullull
    wassdullull New Altair Community Member

    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.

     

  • MartinLiebig
    MartinLiebig
    Altair Employee

    Hi,

     

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

     

    Best,

    Martin