Export the best model from evolutionary optmization

vitor_sousavitor_sousa Member Posts: 3 Contributor I
edited November 2018 in Help

I have been using the evolutionary algorithm to opmize ANN models and I was wondering to know if there is a way to know the details of the best model. I am using cross-validation within the optimization to mitigate the model performance dependence on the data split and initial connection weights and aftewards I try to replicate the best model by running the ANN model (also with cross-validation) using the parameters selected from the optimization to know the model details (number of neurons, connection weights). Unfortunatly, I always get substancially different results and I wonder if there is any way of exporting the details from the best model in the optimization algorithm.

 

Thanks,

 

Vitor

Tagged:

Answers

  • Thomas_OttThomas_Ott RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 1,761 Unicorn

    Whatever operator you put inside the Parameter Optimization operator (Evolutionary included) can have their parameters optimized. The cool thing is that you can also log all those iterations with whatever parameters and performances you want. 

     

    I do a lot of SVM gamma and C parameter optimization so I capture each parameter value during it's iteration AND the accuracy (or some other perf measure). The log creates a nice table that you can sort or view.

     

    Check out the Log inside this process.

     

    <?xml version="1.0" encoding="UTF-8"?><process version="7.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="retrieve" compatibility="7.4.000" expanded="true" height="68" name="Weighting" width="90" x="112" y="30">
    <parameter key="repository_entry" value="//Samples/data/Weighting"/>
    </operator>
    <operator activated="true" class="optimize_parameters_evolutionary" compatibility="6.0.003" expanded="true" height="124" name="Optimize Parameters (Evolutionary)" width="90" x="313" y="30">
    <list key="parameters">
    <parameter key="SVM.C" value="[0.001;100000]"/>
    <parameter key="SVM.gamma" value="[0.001;1.5]"/>
    </list>
    <process expanded="true">
    <operator activated="true" class="split_data" compatibility="7.4.000" expanded="true" height="103" name="Split Data" width="90" x="45" y="30">
    <enumeration key="partitions">
    <parameter key="ratio" value="0.5"/>
    <parameter key="ratio" value="0.5"/>
    </enumeration>
    </operator>
    <operator activated="true" class="support_vector_machine_libsvm" compatibility="7.4.000" expanded="true" height="82" name="SVM" width="90" x="179" y="255">
    <parameter key="gamma" value="0.11475389709742294"/>
    <parameter key="C" value="56462.06496492909"/>
    <list key="class_weights"/>
    </operator>
    <operator activated="true" class="multiply" compatibility="7.4.000" expanded="true" height="103" name="Multiply" width="90" x="313" y="120"/>
    <operator activated="true" class="apply_model" compatibility="7.1.001" expanded="true" height="82" name="Apply Model" width="90" x="447" y="30">
    <list key="application_parameters"/>
    </operator>
    <operator activated="true" class="apply_model" compatibility="7.1.001" expanded="true" height="82" name="Apply Model (2)" width="90" x="447" y="255">
    <list key="application_parameters"/>
    </operator>
    <operator activated="true" class="performance_classification" compatibility="7.4.000" expanded="true" height="82" name="Performance (2)" width="90" x="581" y="255">
    <parameter key="accuracy" value="false"/>
    <parameter key="classification_error" value="true"/>
    <list key="class_weights"/>
    </operator>
    <operator activated="true" class="performance_classification" compatibility="7.4.000" expanded="true" height="82" name="Performance" width="90" x="581" y="30">
    <parameter key="accuracy" value="false"/>
    <parameter key="classification_error" value="true"/>
    <list key="class_weights"/>
    </operator>
    <operator activated="true" class="log" compatibility="7.4.000" expanded="true" height="82" name="Log" width="90" x="715" y="30">
    <parameter key="filename" value="log_values.txt"/>
    <list key="log">
    <parameter key="Count" value="operator.SVM.value.applycount"/>
    <parameter key=" Testing Error" value="operator.Performance.value.performance"/>
    <parameter key="Training Error" value="operator.Performance (2).value.performance"/>
    <parameter key="SVM C" value="operator.SVM.parameter.C"/>
    <parameter key="SVM gamma" value="operator.SVM.parameter.gamma"/>
    </list>
    </operator>
    <connect from_port="input 1" to_op="Split Data" to_port="example set"/>
    <connect from_op="Split Data" from_port="partition 1" to_op="Apply Model" to_port="unlabelled data"/>
    <connect from_op="Split Data" from_port="partition 2" to_op="SVM" to_port="training set"/>
    <connect from_op="SVM" from_port="model" to_op="Multiply" to_port="input"/>
    <connect from_op="SVM" from_port="exampleSet" to_op="Apply Model (2)" to_port="unlabelled data"/>
    <connect from_op="Multiply" from_port="output 1" to_op="Apply Model" to_port="model"/>
    <connect from_op="Multiply" from_port="output 2" to_op="Apply Model (2)" to_port="model"/>
    <connect from_op="Apply Model" from_port="labelled data" to_op="Performance" to_port="labelled data"/>
    <connect from_op="Apply Model (2)" from_port="labelled data" to_op="Performance (2)" to_port="labelled data"/>
    <connect from_op="Performance" from_port="performance" to_op="Log" to_port="through 1"/>
    <connect from_op="Log" from_port="through 1" to_port="performance"/>
    <portSpacing port="source_input 1" spacing="0"/>
    <portSpacing port="source_input 2" spacing="0"/>
    <portSpacing port="sink_performance" spacing="0"/>
    <portSpacing port="sink_result 1" spacing="0"/>
    <portSpacing port="sink_result 2" spacing="0"/>
    </process>
    </operator>
    <connect from_op="Weighting" from_port="output" to_op="Optimize Parameters (Evolutionary)" to_port="input 1"/>
    <connect from_op="Optimize Parameters (Evolutionary)" from_port="result 1" to_port="result 1"/>
    <portSpacing port="source_input 1" spacing="0"/>
    <portSpacing port="sink_result 1" spacing="0"/>
    <portSpacing port="sink_result 2" spacing="18"/>
    </process>
    </operator>
    </process>
Sign In or Register to comment.