How to get the optimum parameter value in a Optimize parameters loop?

vgpoweredvgpowered Member Posts: 20 Contributor II
We are not able to get the best parameter of grid in a Optimize parameter operator when this operator is used inside a loop. Is it possible in a simple way or is it necessary to parse the "parameter set" result to get the optimum "selected parameter"?

Answers

  • rjones13rjones13 Member Posts: 128 Unicorn
    Hi @vgpowered,

    If you turn on "log all criteria" on Optimize Parameters (Grid), then the history will be available in the log under the name of the operator. You could then use perhaps Log to Data and Store/Remember the appropriate values. I've attached a small example of the first part.

    Hope this helps.

    Best,

    Roland
    <?xml version="1.0" encoding="UTF-8"?><process version="10.3.000">
    
    <context>
    <input/>
    <output/>
    <macros/>
    </context>
    <operator activated="true" class="process" compatibility="10.3.000" expanded="true" name="Process" origin="GENERATED_TUTORIAL">
    <parameter key="logverbosity" value="init"/>
    <parameter key="random_seed" value="2001"/>
    <parameter key="send_mail" value="never"/>
    <parameter key="notification_email" value=""/>
    <parameter key="process_duration_for_mail" value="30"/>
    <parameter key="encoding" value="UTF-8"/>
    <process expanded="true">
    <operator activated="true" class="retrieve" compatibility="10.3.000" expanded="true" height="68" name="Weighting" origin="GENERATED_TUTORIAL" width="90" x="112" y="30">
    <parameter key="repository_entry" value="//Samples/data/Weighting"/>
    </operator>
    <operator activated="true" class="concurrency:optimize_parameters_grid" compatibility="10.3.000" expanded="true" height="124" name="Optimize Parameters (Grid)" origin="GENERATED_TUTORIAL" width="90" x="313" y="34">
    <list key="parameters">
    <parameter key="SVM.C" value="[0.001;100000;10;logarithmic]"/>
    <parameter key="SVM.gamma" value="[0.001;1.5;10;logarithmic]"/>
    </list>
    <parameter key="error_handling" value="fail on error"/>
    <parameter key="log_performance" value="true"/>
    <parameter key="log_all_criteria" value="true"/>
    <parameter key="synchronize" value="false"/>
    <parameter key="enable_parallel_execution" value="true"/>
    <process expanded="true">
    <operator activated="true" class="split_data" compatibility="10.1.003" expanded="true" height="103" name="Split Data" origin="GENERATED_TUTORIAL" width="90" x="45" y="30">
    <enumeration key="partitions">
    <parameter key="ratio" value="0.5"/>
    <parameter key="ratio" value="0.5"/>
    </enumeration>
    <parameter key="sampling_type" value="automatic"/>
    <parameter key="use_local_random_seed" value="true"/>
    <parameter key="local_random_seed" value="1992"/>
    </operator>
    <operator activated="true" class="support_vector_machine_libsvm" compatibility="10.3.000" expanded="true" height="82" name="SVM" origin="GENERATED_TUTORIAL" width="90" x="246" y="85">
    <parameter key="svm_type" value="C-SVC"/>
    <parameter key="kernel_type" value="rbf"/>
    <parameter key="degree" value="3"/>
    <parameter key="gamma" value="1.5"/>
    <parameter key="coef0" value="0.0"/>
    <parameter key="C" value="100000.0"/>
    <parameter key="nu" value="0.5"/>
    <parameter key="cache_size" value="80"/>
    <parameter key="epsilon" value="0.001"/>
    <parameter key="p" value="0.1"/>
    <list key="class_weights"/>
    <parameter key="shrinking" value="true"/>
    <parameter key="calculate_confidences" value="false"/>
    <parameter key="confidence_for_multiclass" value="true"/>
    </operator>
    <operator activated="true" class="apply_model" compatibility="10.3.000" expanded="true" height="82" name="Apply Model" origin="GENERATED_TUTORIAL" width="90" x="447" y="30">
    <list key="application_parameters"/>
    </operator>
    <operator activated="true" class="performance_classification" compatibility="10.3.000" expanded="true" height="82" name="Performance" origin="GENERATED_TUTORIAL" width="90" x="581" y="30">
    <parameter key="main_criterion" value="first"/>
    <parameter key="accuracy" value="false"/>
    <parameter key="classification_error" value="true"/>
    <parameter key="kappa" value="false"/>
    <parameter key="weighted_mean_recall" value="false"/>
    <parameter key="weighted_mean_precision" value="false"/>
    <parameter key="spearman_rho" value="false"/>
    <parameter key="kendall_tau" value="false"/>
    <parameter key="absolute_error" value="false"/>
    <parameter key="relative_error" value="false"/>
    <parameter key="relative_error_lenient" value="false"/>
    <parameter key="relative_error_strict" value="false"/>
    <parameter key="normalized_absolute_error" value="false"/>
    <parameter key="root_mean_squared_error" value="false"/>
    <parameter key="root_relative_squared_error" value="false"/>
    <parameter key="squared_error" value="false"/>
    <parameter key="correlation" value="false"/>
    <parameter key="squared_correlation" value="false"/>
    <parameter key="cross-entropy" value="false"/>
    <parameter key="margin" value="false"/>
    <parameter key="soft_margin_loss" value="false"/>
    <parameter key="logistic_loss" value="false"/>
    <parameter key="skip_undefined_labels" value="true"/>
    <parameter key="use_example_weights" value="true"/>
    <list key="class_weights"/>
    </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="Apply Model" to_port="model"/>
    <connect from_op="Apply Model" from_port="labelled data" to_op="Performance" to_port="labelled data"/>
    <connect from_op="Performance" from_port="performance" 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_model" spacing="0"/>
    <portSpacing port="sink_output 1" spacing="0"/>
    </process>
    </operator>
    <operator activated="true" class="log_to_data" compatibility="10.3.000" expanded="true" height="82" name="Log to Data" width="90" x="514" y="136">
    <parameter key="log_name" value="Optimize Parameters (Grid)"/>
    </operator>
    <connect from_op="Weighting" from_port="output" to_op="Optimize Parameters (Grid)" to_port="input 1"/>
    <connect from_op="Optimize Parameters (Grid)" from_port="performance" to_port="result 1"/>
    <connect from_op="Optimize Parameters (Grid)" from_port="parameter set" to_port="result 2"/>
    <connect from_op="Log to Data" from_port="exampleSet" to_port="result 3"/>
    <portSpacing port="source_input 1" spacing="0"/>
    <portSpacing port="sink_result 1" spacing="0"/>
    <portSpacing port="sink_result 2" spacing="18"/>
    <portSpacing port="sink_result 3" spacing="0"/>
    <portSpacing port="sink_result 4" spacing="0"/>
    </process>
    </operator>
    </process>
Sign In or Register to comment.