Skip to content

Commit

Permalink
Add regularization to prox value in minimizer based learning.
Browse files Browse the repository at this point in the history
  • Loading branch information
dickensc committed Sep 8, 2023
1 parent 421a908 commit 0ab7b90
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -499,12 +499,17 @@ private float computeTotalEnergyDifference(float[] incompatibilityDifference){
}

private float computeTotalProxValue(float[] proxRuleIncompatibility) {
float regularizationParameter = 0.0f;
if (trainInferenceApplication.getReasoner() instanceof DualBCDReasoner) {
regularizationParameter = (float)((DualBCDReasoner)trainInferenceApplication.getReasoner()).regularizationParameter;
}

float totalProxValue = 0.0f;
for (int i = 0; i < proxRules.length; i++) {
proxRuleIncompatibility[i] = proxRuleObservedAtoms[i].getValue() - augmentedInferenceAtomValueState[proxIndexToRVAtomIndex.get(i)];
totalProxValue += Math.pow(proxRuleIncompatibility[i], 2.0f);
}
totalProxValue = proxRuleWeight * totalProxValue;
totalProxValue = (regularizationParameter + proxRuleWeight) * totalProxValue;

return totalProxValue;
}
Expand Down

0 comments on commit 0ab7b90

Please sign in to comment.