/** Returns the log probability of the training sequence labels and the prior over parameters. */ public double getValue () { if (crf.weightsValueChangeStamp != cachedValueWeightsStamp) { // The cached value is not up to date; it was calculated for a different set of CRF weights. cachedValueWeightsStamp = crf.weightsValueChangeStamp; // cachedValue will soon no longer be stale long startingTime = System.currentTimeMillis(); //crf.print(); // Get the value of all the all the true labels, also filling in expectations at the same time. cachedValue = getExpectationValue (); // Incorporate prior on parameters if (usingHyperbolicPrior) // Hyperbolic prior cachedValue += crf.parameters.hyberbolicPrior(hyperbolicPriorSlope, hyperbolicPriorSharpness); else // Gaussian prior cachedValue += crf.parameters.gaussianPrior(gaussianPriorVariance); // gsc: make sure the prior gives a correct value assert(!(Double.isNaN(cachedValue) || Double.isInfinite(cachedValue))) : "Label likelihood is NaN/Infinite"; logger.info ("getValue() (loglikelihood, optimizable by label likelihood) = "+cachedValue); long endingTime = System.currentTimeMillis(); logger.fine ("Inference milliseconds = "+(endingTime - startingTime)); } return cachedValue; }
/** Returns the log probability of the training sequence labels and the prior over parameters. */ public double getValue () { if (crf.weightsValueChangeStamp != cachedValueWeightsStamp) { // The cached value is not up to date; it was calculated for a different set of CRF weights. cachedValueWeightsStamp = crf.weightsValueChangeStamp; // cachedValue will soon no longer be stale long startingTime = System.currentTimeMillis(); //crf.print(); // Get the value of all the all the true labels, also filling in expectations at the same time. cachedValue = getExpectationValue (); // Incorporate prior on parameters if (usingHyperbolicPrior) // Hyperbolic prior cachedValue += crf.parameters.hyberbolicPrior(hyperbolicPriorSlope, hyperbolicPriorSharpness); else // Gaussian prior cachedValue += crf.parameters.gaussianPrior(gaussianPriorVariance); // gsc: make sure the prior gives a correct value assert(!(Double.isNaN(cachedValue) || Double.isInfinite(cachedValue))) : "Label likelihood is NaN/Infinite"; logger.info ("getValue() (loglikelihood, optimizable by label likelihood) = "+cachedValue); long endingTime = System.currentTimeMillis(); logger.fine ("Inference milliseconds = "+(endingTime - startingTime)); } return cachedValue; }
/** Returns the log probability of the training sequence labels and the prior over parameters. */ public double getValue () { if (crf.weightsValueChangeStamp != cachedValueWeightsStamp) { // The cached value is not up to date; it was calculated for a different set of CRF weights. cachedValueWeightsStamp = crf.weightsValueChangeStamp; // cachedValue will soon no longer be stale long startingTime = System.currentTimeMillis(); //crf.print(); // Get the value of all the all the true labels, also filling in expectations at the same time. cachedValue = getExpectationValue (); // Incorporate prior on parameters if (usingHyperbolicPrior) // Hyperbolic prior cachedValue += crf.parameters.hyberbolicPrior(hyperbolicPriorSlope, hyperbolicPriorSharpness); else // Gaussian prior cachedValue += crf.parameters.gaussianPrior(gaussianPriorVariance); // gsc: make sure the prior gives a correct value assert(!(Double.isNaN(cachedValue) || Double.isInfinite(cachedValue))) : "Label likelihood is NaN/Infinite"; logger.info ("getValue() (loglikelihood, optimizable by label likelihood) = "+cachedValue); long endingTime = System.currentTimeMillis(); logger.fine ("Inference milliseconds = "+(endingTime - startingTime)); } return cachedValue; }