From efa8fea367bb64746b97d0bd036c4c803fb04136 Mon Sep 17 00:00:00 2001 From: "julian.treiber" Date: Sat, 7 Mar 2020 09:45:29 +0100 Subject: [PATCH] added metric loss accuracy_ignore_label --- .../de/monticore/lang/monticar/CNNTrain.mc4 | 14 +++++++++----- .../cnntrain/_cocos/ParameterAlgorithmMapping.java | 1 + 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/main/grammars/de/monticore/lang/monticar/CNNTrain.mc4 b/src/main/grammars/de/monticore/lang/monticar/CNNTrain.mc4 index d517e60..3c043c9 100644 --- a/src/main/grammars/de/monticore/lang/monticar/CNNTrain.mc4 +++ b/src/main/grammars/de/monticore/lang/monticar/CNNTrain.mc4 @@ -61,7 +61,7 @@ grammar CNNTrain extends de.monticore.lang.monticar.Common2, de.monticore.Number interface AccIgnoreLabelEntry extends Entry; AxisAccIgnoreLabelEntry implements AccIgnoreLabelEntry = name:"axis" ":" value:IntegerValue; - IgnoreLabelAccIgnoreLabelEntry implements AccIgnoreLabelEntry = name:"ignore_label" ":" value:IntegerValue; + IgnoreLabelAccIgnoreLabelEntry implements AccIgnoreLabelEntry = name:"metric_ignore_label" ":" value:IntegerValue; EvalTrainEntry implements ConfigEntry = name:"eval_train" ":" value:BooleanValue; @@ -100,6 +100,9 @@ grammar CNNTrain extends de.monticore.lang.monticar.Common2, de.monticore.Number interface DiceEntry extends Entry; DiceLoss implements LossValue = name:"dice_loss" ("{" params:DiceEntry* "}")?; + interface SoftmaxCrossEntropyIgnoreLabelEntry extends Entry; + SoftmaxCrossEntropyIgnoreLabelLoss implements LossValue = name:"softmax_cross_entropy_ignore_label" ("{" params:SoftmaxCrossEntropyIgnoreLabelEntry* "}")?; + SigmoidBinaryCrossEntropyLoss implements LossValue = name:"sigmoid_binary_cross_entropy" ("{" params:Entry* "}")?; interface HingeEntry extends Entry; @@ -114,11 +117,12 @@ grammar CNNTrain extends de.monticore.lang.monticar.Common2, de.monticore.Number interface KullbackLeiblerEntry extends Entry; KullbackLeiblerLoss implements LossValue = name:"kullback_leibler" ("{" params:KullbackLeiblerEntry* "}")?; - SparseLabelEntry implements CrossEntropyEntry, SoftmaxCrossEntropyEntry, SoftmaxCrossEntropyIgnoreIndicesEntry, DiceEntry = name:"sparse_label" ":" value:BooleanValue; - FromLogitsEntry implements SoftmaxCrossEntropyEntry, SoftmaxCrossEntropyIgnoreIndicesEntry, KullbackLeiblerEntry, DiceEntry = name:"from_logits" ":" value:BooleanValue; - LossAxisEntry implements CrossEntropyEntry, SoftmaxCrossEntropyEntry, SoftmaxCrossEntropyIgnoreIndicesEntry, DiceEntry = name:"loss_axis" ":" value:IntegerValue; - BatchAxisEntry implements CrossEntropyEntry, SoftmaxCrossEntropyEntry, SoftmaxCrossEntropyIgnoreIndicesEntry, DiceEntry = name:"batch_axis" ":" value:IntegerValue; + SparseLabelEntry implements CrossEntropyEntry, SoftmaxCrossEntropyEntry, SoftmaxCrossEntropyIgnoreIndicesEntry, DiceEntry, SoftmaxCrossEntropyIgnoreLabelEntry = name:"sparse_label" ":" value:BooleanValue; + FromLogitsEntry implements SoftmaxCrossEntropyEntry, SoftmaxCrossEntropyIgnoreIndicesEntry, KullbackLeiblerEntry, DiceEntry, SoftmaxCrossEntropyIgnoreLabelEntry = name:"from_logits" ":" value:BooleanValue; + LossAxisEntry implements CrossEntropyEntry, SoftmaxCrossEntropyEntry, SoftmaxCrossEntropyIgnoreIndicesEntry, DiceEntry,SoftmaxCrossEntropyIgnoreLabelEntry = name:"loss_axis" ":" value:IntegerValue; + BatchAxisEntry implements CrossEntropyEntry, SoftmaxCrossEntropyEntry, SoftmaxCrossEntropyIgnoreIndicesEntry, DiceEntry, SoftmaxCrossEntropyIgnoreLabelEntry = name:"batch_axis" ":" value:IntegerValue; IgnoreIndicesEntry implements SoftmaxCrossEntropyIgnoreIndicesEntry = name:"ignore_indices" ":" value:IntegerValue; + IgnoreLabelEntry implements SoftmaxCrossEntropyIgnoreLabelEntry = name:"loss_ignore_label" ":" value:IntegerValue; MarginEntry implements HingeEntry, SquaredHingeEntry = name:"margin" ":" value:NumberValue; LabelFormatEntry implements LogisticEntry = name:"label_format" ":" value:StringValue; diff --git a/src/main/java/de/monticore/lang/monticar/cnntrain/_cocos/ParameterAlgorithmMapping.java b/src/main/java/de/monticore/lang/monticar/cnntrain/_cocos/ParameterAlgorithmMapping.java index d2904e9..a340001 100644 --- a/src/main/java/de/monticore/lang/monticar/cnntrain/_cocos/ParameterAlgorithmMapping.java +++ b/src/main/java/de/monticore/lang/monticar/cnntrain/_cocos/ParameterAlgorithmMapping.java @@ -54,6 +54,7 @@ class ParameterAlgorithmMapping { ASTBatchAxisEntry.class, ASTFromLogitsEntry.class, ASTIgnoreIndicesEntry.class, + ASTIgnoreLabelEntry.class, ASTMarginEntry.class, ASTLabelFormatEntry.class, ASTRhoEntry.class, -- GitLab