示例#1
0
 static double log(double val) {
   try {
     return logE(val);
   } catch (Exception e) {
     System.out.println(e.getMessage());
     e.printStackTrace();
   }
   return -1 * Double.MAX_VALUE;
 }
示例#2
0
 static double expLE(double val) {
   double pr = RobustMath.exp(val);
   if (Double.isNaN(pr) || Double.isInfinite(pr)) {
     try {
       throw new Exception(
           "Overflow error when taking exp of "
               + val
               + " you might need to redesign feature values so as to not reach such high values");
     } catch (Exception e) {
       System.out.println(e.getMessage());
       e.printStackTrace();
       return Double.MAX_VALUE;
     }
   }
   return pr;
 }
示例#3
0
 static double expE(double val) {
   double pr = RobustMath.exp(val);
   if (Double.isNaN(pr) || Double.isInfinite(pr)) {
     try {
       throw new Exception(
           "Overflow error when taking exp of "
               + val
               + "\n Try running the CRF with the following option \"trainer ll\" to perform computations in the log-space.");
     } catch (Exception e) {
       System.out.println(e.getMessage());
       e.printStackTrace();
       return Double.MAX_VALUE;
     }
   }
   return pr;
 }