Bug in Optimize Parameter operator?

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

hi,

 

I was using k-nn inside optimize parameter (inside X-Validation) operator... and I was using euklidean and camberra distance for opt parameter settings...

but I noticed, that when using name "k-NN (2)" inside opt. parameter, it does not change the numerical_measure type... when I use a standard name "k-NN", it does change the parameters during running... seems to be a minor bug caused by the naming of the parameter as I experienced it?

Welcome!

It looks like you're new here. Sign in or register to get started.

Best Answers

  • Fred12
    Fred12 New Altair Community Member
    Answer ✓

    ok here is a quick sample process where I used both k-NN:

    in the one log the 2 distances show up, but not in the other:

     

    <?xml version="1.0" encoding="UTF-8"?><process version="7.4.000">
    <context>
    <input/>
    <output/>
    <macros/>
    </context>
    <operator activated="true" class="process" compatibility="7.4.000" expanded="true" name="Process">
    <process expanded="true">
    <operator activated="true" class="retrieve" compatibility="7.4.000" expanded="true" height="68" name="Retrieve Iris" width="90" x="45" y="85">
    <parameter key="repository_entry" value="//Samples/data/Iris"/>
    </operator>
    <operator activated="false" class="x_validation" compatibility="7.4.000" expanded="true" height="124" name="Validation" width="90" x="447" y="34">
    <parameter key="number_of_validations" value="4"/>
    <parameter key="sampling_type" value="stratified sampling"/>
    <process expanded="true">
    <operator activated="true" class="support_vector_machine_libsvm" compatibility="7.4.000" expanded="true" height="82" name="SVM" width="90" x="112" y="34">
    <parameter key="gamma" value="0.007170375144641631"/>
    <parameter key="C" value="227500.0"/>
    <list key="class_weights"/>
    </operator>
    <connect from_port="training" to_op="SVM" to_port="training set"/>
    <connect from_op="SVM" from_port="model" to_port="model"/>
    <portSpacing port="source_training" spacing="0"/>
    <portSpacing port="sink_model" spacing="0"/>
    <portSpacing port="sink_through 1" spacing="0"/>
    </process>
    <process expanded="true">
    <operator activated="true" class="apply_model" compatibility="7.4.000" expanded="true" height="82" name="Apply Model" width="90" x="112" y="34">
    <list key="application_parameters"/>
    </operator>
    <operator activated="true" class="performance_classification" compatibility="7.4.000" expanded="true" height="82" name="Performance" width="90" x="313" y="34">
    <parameter key="kappa" value="true"/>
    <parameter key="weighted_mean_recall" value="true"/>
    <parameter key="weighted_mean_precision" value="true"/>
    <parameter key="correlation" value="true"/>
    <parameter key="squared_correlation" value="true"/>
    <parameter key="margin" value="true"/>
    <list key="class_weights"/>
    </operator>
    <connect from_port="model" to_op="Apply Model" to_port="model"/>
    <connect from_port="test set" to_op="Apply Model" to_port="unlabelled data"/>
    <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="averagable 1"/>
    <portSpacing port="source_model" spacing="0"/>
    <portSpacing port="source_test set" spacing="0"/>
    <portSpacing port="source_through 1" spacing="0"/>
    <portSpacing port="sink_averagable 1" spacing="0"/>
    <portSpacing port="sink_averagable 2" spacing="0"/>
    </process>
    </operator>
    <operator activated="true" class="retrieve" compatibility="7.4.000" expanded="true" height="68" name="Retrieve Iris (2)" width="90" x="112" y="340">
    <parameter key="repository_entry" value="//Samples/data/Iris"/>
    </operator>
    <operator activated="true" class="optimize_parameters_grid" compatibility="7.4.000" expanded="true" height="103" name="Optimize Parameters (Grid)" width="90" x="246" y="187">
    <list key="parameters">
    <parameter key="k-NN.k" value="[1.0;20;6;linear]"/>
    <parameter key="k-NN.numerical_measure" value="EuclideanDistance,CamberraDistance"/>
    </list>
    <process expanded="true">
    <operator activated="true" class="concurrency:cross_validation" compatibility="7.4.000" expanded="true" height="145" name="Cross Validation (2)" width="90" x="179" y="34">
    <process expanded="true">
    <operator activated="true" class="k_nn" compatibility="7.4.000" expanded="true" height="82" name="k-NN" width="90" x="179" y="85">
    <parameter key="k" value="20"/>
    <parameter key="numerical_measure" value="CamberraDistance"/>
    </operator>
    <connect from_port="training set" to_op="k-NN" to_port="training set"/>
    <connect from_op="k-NN" from_port="model" to_port="model"/>
    <portSpacing port="source_training set" spacing="0"/>
    <portSpacing port="sink_model" spacing="0"/>
    <portSpacing port="sink_through 1" spacing="0"/>
    </process>
    <process expanded="true">
    <operator activated="true" class="apply_model" compatibility="7.4.000" expanded="true" height="82" name="Apply Model (3)" width="90" x="112" y="34">
    <list key="application_parameters"/>
    </operator>
    <operator activated="true" class="performance_classification" compatibility="7.4.000" expanded="true" height="82" name="Performance (3)" width="90" x="313" y="34">
    <parameter key="kappa" value="true"/>
    <parameter key="weighted_mean_recall" value="true"/>
    <parameter key="weighted_mean_precision" value="true"/>
    <parameter key="correlation" value="true"/>
    <parameter key="squared_correlation" value="true"/>
    <parameter key="margin" value="true"/>
    <list key="class_weights"/>
    </operator>
    <connect from_port="model" to_op="Apply Model (3)" to_port="model"/>
    <connect from_port="test set" to_op="Apply Model (3)" to_port="unlabelled data"/>
    <connect from_op="Apply Model (3)" from_port="labelled data" to_op="Performance (3)" to_port="labelled data"/>
    <connect from_op="Performance (3)" from_port="performance" to_port="performance 1"/>
    <connect from_op="Performance (3)" from_port="example set" to_port="test set results"/>
    <portSpacing port="source_model" spacing="0"/>
    <portSpacing port="source_test set" spacing="0"/>
    <portSpacing port="source_through 1" spacing="0"/>
    <portSpacing port="sink_test set results" spacing="0"/>
    <portSpacing port="sink_performance 1" spacing="0"/>
    <portSpacing port="sink_performance 2" spacing="0"/>
    </process>
    </operator>
    <operator activated="true" class="log" compatibility="7.4.000" expanded="true" height="82" name="Log (3)" width="90" x="380" y="85">
    <list key="log">
    <parameter key="k" value="operator.k-NN.parameter.k"/>
    <parameter key="nummeasure" value="operator.k-NN.parameter.numerical_measure"/>
    </list>
    </operator>
    <connect from_port="input 1" to_op="Cross Validation (2)" to_port="example set"/>
    <connect from_op="Cross Validation (2)" from_port="performance 1" to_op="Log (3)" to_port="through 1"/>
    <connect from_op="Log (3)" 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"/>
    </process>
    </operator>
    <operator activated="true" class="optimize_parameters_grid" compatibility="7.4.000" expanded="true" height="103" name="Optimize Parameters (2)" width="90" x="246" y="340">
    <list key="parameters">
    <parameter key="k-NN (2).k" value="[1.0;20;6;linear]"/>
    <parameter key="k-NN (2).numerical_measure" value="EuclideanDistance,CamberraDistance"/>
    </list>
    <process expanded="true">
    <operator activated="true" class="concurrency:cross_validation" compatibility="7.4.000" expanded="true" height="145" name="Cross Validation (3)" width="90" x="179" y="34">
    <process expanded="true">
    <operator activated="true" class="k_nn" compatibility="7.4.000" expanded="true" height="82" name="k-NN (2)" width="90" x="179" y="85">
    <parameter key="k" value="20"/>
    <parameter key="numerical_measure" value="CamberraDistance"/>
    </operator>
    <connect from_port="training set" to_op="k-NN (2)" to_port="training set"/>
    <connect from_op="k-NN (2)" from_port="model" to_port="model"/>
    <portSpacing port="source_training set" spacing="0"/>
    <portSpacing port="sink_model" spacing="0"/>
    <portSpacing port="sink_through 1" spacing="0"/>
    </process>
    <process expanded="true">
    <operator activated="true" class="apply_model" compatibility="7.4.000" expanded="true" height="82" name="Apply Model (4)" width="90" x="112" y="34">
    <list key="application_parameters"/>
    </operator>
    <operator activated="true" class="performance_classification" compatibility="7.4.000" expanded="true" height="82" name="Performance (4)" width="90" x="313" y="34">
    <parameter key="kappa" value="true"/>
    <parameter key="weighted_mean_recall" value="true"/>
    <parameter key="weighted_mean_precision" value="true"/>
    <parameter key="correlation" value="true"/>
    <parameter key="squared_correlation" value="true"/>
    <parameter key="margin" value="true"/>
    <list key="class_weights"/>
    </operator>
    <connect from_port="model" to_op="Apply Model (4)" to_port="model"/>
    <connect from_port="test set" to_op="Apply Model (4)" to_port="unlabelled data"/>
    <connect from_op="Apply Model (4)" from_port="labelled data" to_op="Performance (4)" to_port="labelled data"/>
    <connect from_op="Performance (4)" from_port="performance" to_port="performance 1"/>
    <connect from_op="Performance (4)" from_port="example set" to_port="test set results"/>
    <portSpacing port="source_model" spacing="0"/>
    <portSpacing port="source_test set" spacing="0"/>
    <portSpacing port="source_through 1" spacing="0"/>
    <portSpacing port="sink_test set results" spacing="0"/>
    <portSpacing port="sink_performance 1" spacing="0"/>
    <portSpacing port="sink_performance 2" spacing="0"/>
    </process>
    </operator>
    <operator activated="true" class="log" compatibility="7.4.000" expanded="true" height="82" name="Log (4)" width="90" x="447" y="85">
    <list key="log">
    <parameter key="k" value="operator.k-NN.parameter.k"/>
    <parameter key="nummeasure" value="operator.k-NN.parameter.numerical_measure"/>
    </list>
    </operator>
    <connect from_port="input 1" to_op="Cross Validation (3)" to_port="example set"/>
    <connect from_op="Cross Validation (3)" from_port="performance 1" to_op="Log (4)" to_port="through 1"/>
    <connect from_op="Log (4)" 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"/>
    </process>
    </operator>
    <connect from_op="Retrieve Iris" from_port="output" to_op="Optimize Parameters (Grid)" to_port="input 1"/>
    <connect from_op="Retrieve Iris (2)" from_port="output" to_op="Optimize Parameters (2)" to_port="input 1"/>
    <connect from_op="Optimize Parameters (Grid)" from_port="performance" to_port="result 1"/>
    <connect from_op="Optimize Parameters (2)" from_port="performance" 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>
  • Thomas_Ott
    Thomas_Ott New Altair Community Member
    Answer ✓

    Thanks @Fred12 for the process. I've tested it with a lower compatability too and the problem is the same. I have pinged the developers. 

Answers

  • IngoRM
    IngoRM New Altair Community Member

    Hi,

     

    Thanks for pointing this out.  Can you do us a quick favor and post the XML of a process using a data set from the Sample repository?  This would allow our engineers to replicate and chase this bug.

     

    Thanks,

    Ingo

  • Fred12
    Fred12 New Altair Community Member
    Answer ✓

    ok here is a quick sample process where I used both k-NN:

    in the one log the 2 distances show up, but not in the other:

     

    <?xml version="1.0" encoding="UTF-8"?><process version="7.4.000">
    <context>
    <input/>
    <output/>
    <macros/>
    </context>
    <operator activated="true" class="process" compatibility="7.4.000" expanded="true" name="Process">
    <process expanded="true">
    <operator activated="true" class="retrieve" compatibility="7.4.000" expanded="true" height="68" name="Retrieve Iris" width="90" x="45" y="85">
    <parameter key="repository_entry" value="//Samples/data/Iris"/>
    </operator>
    <operator activated="false" class="x_validation" compatibility="7.4.000" expanded="true" height="124" name="Validation" width="90" x="447" y="34">
    <parameter key="number_of_validations" value="4"/>
    <parameter key="sampling_type" value="stratified sampling"/>
    <process expanded="true">
    <operator activated="true" class="support_vector_machine_libsvm" compatibility="7.4.000" expanded="true" height="82" name="SVM" width="90" x="112" y="34">
    <parameter key="gamma" value="0.007170375144641631"/>
    <parameter key="C" value="227500.0"/>
    <list key="class_weights"/>
    </operator>
    <connect from_port="training" to_op="SVM" to_port="training set"/>
    <connect from_op="SVM" from_port="model" to_port="model"/>
    <portSpacing port="source_training" spacing="0"/>
    <portSpacing port="sink_model" spacing="0"/>
    <portSpacing port="sink_through 1" spacing="0"/>
    </process>
    <process expanded="true">
    <operator activated="true" class="apply_model" compatibility="7.4.000" expanded="true" height="82" name="Apply Model" width="90" x="112" y="34">
    <list key="application_parameters"/>
    </operator>
    <operator activated="true" class="performance_classification" compatibility="7.4.000" expanded="true" height="82" name="Performance" width="90" x="313" y="34">
    <parameter key="kappa" value="true"/>
    <parameter key="weighted_mean_recall" value="true"/>
    <parameter key="weighted_mean_precision" value="true"/>
    <parameter key="correlation" value="true"/>
    <parameter key="squared_correlation" value="true"/>
    <parameter key="margin" value="true"/>
    <list key="class_weights"/>
    </operator>
    <connect from_port="model" to_op="Apply Model" to_port="model"/>
    <connect from_port="test set" to_op="Apply Model" to_port="unlabelled data"/>
    <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="averagable 1"/>
    <portSpacing port="source_model" spacing="0"/>
    <portSpacing port="source_test set" spacing="0"/>
    <portSpacing port="source_through 1" spacing="0"/>
    <portSpacing port="sink_averagable 1" spacing="0"/>
    <portSpacing port="sink_averagable 2" spacing="0"/>
    </process>
    </operator>
    <operator activated="true" class="retrieve" compatibility="7.4.000" expanded="true" height="68" name="Retrieve Iris (2)" width="90" x="112" y="340">
    <parameter key="repository_entry" value="//Samples/data/Iris"/>
    </operator>
    <operator activated="true" class="optimize_parameters_grid" compatibility="7.4.000" expanded="true" height="103" name="Optimize Parameters (Grid)" width="90" x="246" y="187">
    <list key="parameters">
    <parameter key="k-NN.k" value="[1.0;20;6;linear]"/>
    <parameter key="k-NN.numerical_measure" value="EuclideanDistance,CamberraDistance"/>
    </list>
    <process expanded="true">
    <operator activated="true" class="concurrency:cross_validation" compatibility="7.4.000" expanded="true" height="145" name="Cross Validation (2)" width="90" x="179" y="34">
    <process expanded="true">
    <operator activated="true" class="k_nn" compatibility="7.4.000" expanded="true" height="82" name="k-NN" width="90" x="179" y="85">
    <parameter key="k" value="20"/>
    <parameter key="numerical_measure" value="CamberraDistance"/>
    </operator>
    <connect from_port="training set" to_op="k-NN" to_port="training set"/>
    <connect from_op="k-NN" from_port="model" to_port="model"/>
    <portSpacing port="source_training set" spacing="0"/>
    <portSpacing port="sink_model" spacing="0"/>
    <portSpacing port="sink_through 1" spacing="0"/>
    </process>
    <process expanded="true">
    <operator activated="true" class="apply_model" compatibility="7.4.000" expanded="true" height="82" name="Apply Model (3)" width="90" x="112" y="34">
    <list key="application_parameters"/>
    </operator>
    <operator activated="true" class="performance_classification" compatibility="7.4.000" expanded="true" height="82" name="Performance (3)" width="90" x="313" y="34">
    <parameter key="kappa" value="true"/>
    <parameter key="weighted_mean_recall" value="true"/>
    <parameter key="weighted_mean_precision" value="true"/>
    <parameter key="correlation" value="true"/>
    <parameter key="squared_correlation" value="true"/>
    <parameter key="margin" value="true"/>
    <list key="class_weights"/>
    </operator>
    <connect from_port="model" to_op="Apply Model (3)" to_port="model"/>
    <connect from_port="test set" to_op="Apply Model (3)" to_port="unlabelled data"/>
    <connect from_op="Apply Model (3)" from_port="labelled data" to_op="Performance (3)" to_port="labelled data"/>
    <connect from_op="Performance (3)" from_port="performance" to_port="performance 1"/>
    <connect from_op="Performance (3)" from_port="example set" to_port="test set results"/>
    <portSpacing port="source_model" spacing="0"/>
    <portSpacing port="source_test set" spacing="0"/>
    <portSpacing port="source_through 1" spacing="0"/>
    <portSpacing port="sink_test set results" spacing="0"/>
    <portSpacing port="sink_performance 1" spacing="0"/>
    <portSpacing port="sink_performance 2" spacing="0"/>
    </process>
    </operator>
    <operator activated="true" class="log" compatibility="7.4.000" expanded="true" height="82" name="Log (3)" width="90" x="380" y="85">
    <list key="log">
    <parameter key="k" value="operator.k-NN.parameter.k"/>
    <parameter key="nummeasure" value="operator.k-NN.parameter.numerical_measure"/>
    </list>
    </operator>
    <connect from_port="input 1" to_op="Cross Validation (2)" to_port="example set"/>
    <connect from_op="Cross Validation (2)" from_port="performance 1" to_op="Log (3)" to_port="through 1"/>
    <connect from_op="Log (3)" 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"/>
    </process>
    </operator>
    <operator activated="true" class="optimize_parameters_grid" compatibility="7.4.000" expanded="true" height="103" name="Optimize Parameters (2)" width="90" x="246" y="340">
    <list key="parameters">
    <parameter key="k-NN (2).k" value="[1.0;20;6;linear]"/>
    <parameter key="k-NN (2).numerical_measure" value="EuclideanDistance,CamberraDistance"/>
    </list>
    <process expanded="true">
    <operator activated="true" class="concurrency:cross_validation" compatibility="7.4.000" expanded="true" height="145" name="Cross Validation (3)" width="90" x="179" y="34">
    <process expanded="true">
    <operator activated="true" class="k_nn" compatibility="7.4.000" expanded="true" height="82" name="k-NN (2)" width="90" x="179" y="85">
    <parameter key="k" value="20"/>
    <parameter key="numerical_measure" value="CamberraDistance"/>
    </operator>
    <connect from_port="training set" to_op="k-NN (2)" to_port="training set"/>
    <connect from_op="k-NN (2)" from_port="model" to_port="model"/>
    <portSpacing port="source_training set" spacing="0"/>
    <portSpacing port="sink_model" spacing="0"/>
    <portSpacing port="sink_through 1" spacing="0"/>
    </process>
    <process expanded="true">
    <operator activated="true" class="apply_model" compatibility="7.4.000" expanded="true" height="82" name="Apply Model (4)" width="90" x="112" y="34">
    <list key="application_parameters"/>
    </operator>
    <operator activated="true" class="performance_classification" compatibility="7.4.000" expanded="true" height="82" name="Performance (4)" width="90" x="313" y="34">
    <parameter key="kappa" value="true"/>
    <parameter key="weighted_mean_recall" value="true"/>
    <parameter key="weighted_mean_precision" value="true"/>
    <parameter key="correlation" value="true"/>
    <parameter key="squared_correlation" value="true"/>
    <parameter key="margin" value="true"/>
    <list key="class_weights"/>
    </operator>
    <connect from_port="model" to_op="Apply Model (4)" to_port="model"/>
    <connect from_port="test set" to_op="Apply Model (4)" to_port="unlabelled data"/>
    <connect from_op="Apply Model (4)" from_port="labelled data" to_op="Performance (4)" to_port="labelled data"/>
    <connect from_op="Performance (4)" from_port="performance" to_port="performance 1"/>
    <connect from_op="Performance (4)" from_port="example set" to_port="test set results"/>
    <portSpacing port="source_model" spacing="0"/>
    <portSpacing port="source_test set" spacing="0"/>
    <portSpacing port="source_through 1" spacing="0"/>
    <portSpacing port="sink_test set results" spacing="0"/>
    <portSpacing port="sink_performance 1" spacing="0"/>
    <portSpacing port="sink_performance 2" spacing="0"/>
    </process>
    </operator>
    <operator activated="true" class="log" compatibility="7.4.000" expanded="true" height="82" name="Log (4)" width="90" x="447" y="85">
    <list key="log">
    <parameter key="k" value="operator.k-NN.parameter.k"/>
    <parameter key="nummeasure" value="operator.k-NN.parameter.numerical_measure"/>
    </list>
    </operator>
    <connect from_port="input 1" to_op="Cross Validation (3)" to_port="example set"/>
    <connect from_op="Cross Validation (3)" from_port="performance 1" to_op="Log (4)" to_port="through 1"/>
    <connect from_op="Log (4)" 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"/>
    </process>
    </operator>
    <connect from_op="Retrieve Iris" from_port="output" to_op="Optimize Parameters (Grid)" to_port="input 1"/>
    <connect from_op="Retrieve Iris (2)" from_port="output" to_op="Optimize Parameters (2)" to_port="input 1"/>
    <connect from_op="Optimize Parameters (Grid)" from_port="performance" to_port="result 1"/>
    <connect from_op="Optimize Parameters (2)" from_port="performance" 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>
  • Thomas_Ott
    Thomas_Ott New Altair Community Member
    Answer ✓

    Thanks @Fred12 for the process. I've tested it with a lower compatability too and the problem is the same. I have pinged the developers. 

Welcome!

It looks like you're new here. Sign in or register to get started.

Welcome!

It looks like you're new here. Sign in or register to get started.