Commit a17f49c9 authored by Sebastian Nickels's avatar Sebastian Nickels

Updated for eval metric params

parent edc4763a
Pipeline #204108 failed with stages
in 2 minutes and 37 seconds
......@@ -16,7 +16,7 @@
<!-- .. SE-Libraries .................................................. -->
<CNNArch.version>0.3.2-SNAPSHOT</CNNArch.version>
<CNNTrain.version>0.3.6-SNAPSHOT</CNNTrain.version>
<CNNTrain.version>0.3.8-SNAPSHOT</CNNTrain.version>
<CNNArch2X.version>0.0.3-SNAPSHOT</CNNArch2X.version>
<embedded-montiarc-math-opt-generator>0.1.4</embedded-montiarc-math-opt-generator>
......
package de.monticore.lang.monticar.cnnarch.caffe2generator;
import de.monticore.lang.monticar.cnntrain._symboltable.*;
import static de.monticore.lang.monticar.cnntrain.helper.ConfigEntryNameConstants.*;
import java.util.ArrayList;
import java.util.HashMap;
......@@ -60,11 +61,8 @@ public class ConfigurationData {
return getConfiguration().getEntry("context").getValue().toString();
}
public String getEvalMetric() {
if (!getConfiguration().getEntryMap().containsKey("eval_metric")) {
return null;
}
return getConfiguration().getEntry("eval_metric").getValue().toString();
public Map<String, Object> getEvalMetric() {
return getMultiParamEntry(EVAL_METRIC, "name");
}
public String getLoss() {
......@@ -103,4 +101,29 @@ public class ConfigurationData {
}
return mapToStrings;
}
protected Map<String, Object> getMultiParamEntry(final String key, final String valueName) {
if (!configurationContainsKey(key)) {
return null;
}
Map<String, Object> resultView = new HashMap<>();
ValueSymbol value = this.getConfiguration().getEntryMap().get(key).getValue();
if (value instanceof MultiParamValueSymbol) {
MultiParamValueSymbol multiParamValue = (MultiParamValueSymbol) value;
resultView.put(valueName, multiParamValue.getValue());
resultView.putAll(multiParamValue.getParameters());
}
else {
resultView.put(valueName, value.getValue());
}
return resultView;
}
protected Boolean configurationContainsKey(final String key) {
return this.getConfiguration().getEntryMap().containsKey(key);
}
}
......@@ -27,7 +27,7 @@ if __name__ == "__main__":
context='${config.context}',
</#if>
<#if (config.evalMetric)??>
eval_metric='${config.evalMetric}',
eval_metric='${config.evalMetric.name}',
</#if>
<#if (config.loss)??>
loss='${config.loss}',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment