Пример #1
0
 def calc_probability_of_LP_solution(self, help_variables):
     log_prob = 0
     for (i, j, is_PE_link), variable in help_variables.iteritems():
         print self.contamination_ratio * self.observations[
             (i, j, is_PE_link)][1] * normpdf(variable.varValue,
                                              self.contamination_mean,
                                              self.contamination_stddev)
         if is_PE_link:
             try:
                 log_prob += math.log(
                     self.contamination_ratio *
                     self.observations[(i, j, is_PE_link)][1] *
                     normpdf(variable.varValue, self.contamination_mean,
                             self.contamination_stddev))
             except ValueError:
                 log_prob += -float("inf")
         else:
             try:
                 log_prob += math.log(
                     (1 - self.contamination_ratio) *
                     self.observations[(i, j, is_PE_link)][1] *
                     normpdf(variable.varValue, self.contamination_mean,
                             self.contamination_stddev))
             except ValueError:
                 log_prob += -float("inf")
     return log_prob
Пример #2
0
 def Part(a, b):
     expr1 = (min(len1, len2) - (param.read_len - param.s_inner)) / param.readfrequency * normcdf(a, 0, 1)
     expr2 = -(-param.s_inner) / param.readfrequency * normcdf(b, 0, 1)
     expr3 = (b * std_dev) / param.readfrequency * (normcdf(b, 0, 1) - normcdf(a, 0, 1))
     expr4 = (std_dev / param.readfrequency) * (normpdf(b, 0, 1) - normpdf(a, 0, 1))
     value = expr1 + expr2 + expr3 + expr4
     return value
Пример #3
0
 def calc_log_likelihood(self,mean,stddev):
     log_likelihood_value = 0
     exp_mean_over_bp = mean + stddev**2/float(mean+1)
     for (c1,c2) in self.isizes:
         log_likelihood_value += math.log( normpdf(self.isizes[(c1,c2)],exp_mean_over_bp, stddev) ) * self.observations[(c1,c2)][1]
         #for isize in self.isizes[(c1,c2)]:
         #    log_likelihood_value += math.log( normpdf(isize,mean,stddev) )
         
     return log_likelihood_value
Пример #4
0
 def calc_log_likelihood(self,mean,stddev):
     log_likelihood_value = 0
     exp_mean_over_bp = mean + stddev**2/float(mean+1)
     for (c1,c2) in self.isizes:
         log_likelihood_value += math.log( normpdf(self.isizes[(c1,c2)],exp_mean_over_bp, stddev) ) * self.observations[(c1,c2)][1]
         #for isize in self.isizes[(c1,c2)]:
         #    log_likelihood_value += math.log( normpdf(isize,mean,stddev) )
         
     return log_likelihood_value
Пример #5
0
 def calc_probability_of_LP_solution(self, help_variables):
     log_prob = 0
     for (i,j,is_PE_link),variable in help_variables.iteritems():
         print self.contamination_ratio * self.observations[(i,j,is_PE_link)][1] * normpdf(variable.varValue,self.contamination_mean,self.contamination_stddev)
         if is_PE_link:
             try:
                 log_prob += math.log(self.contamination_ratio * self.observations[(i,j,is_PE_link)][1] * normpdf(variable.varValue,self.contamination_mean,self.contamination_stddev)) 
             except ValueError:
                 log_prob += - float("inf")
         else:
             try:
                 log_prob += math.log((1 - self.contamination_ratio) * self.observations[(i,j,is_PE_link)][1]* normpdf(variable.varValue,self.contamination_mean,self.contamination_stddev)) 
             except ValueError:
                 log_prob += - float("inf")
     return log_prob