def trace(self): debug("Trace called") data = self.data_source.get_counts() if sum(data) == 0.0: return mn = self.param_list[0].min_val mx = self.param_list[0].max_val stride = (mx - mn)/self.num_points_to_plot score_lists = [] inverted_maxima = [] overall_max = [] for i, parameter in enumerate(self.param_list): tree = self.trees[i] to_optimize = TreeLikelihoodFunc(tree, data, parameter) prev = parameter.value curr = mn sc = [] max_pt = (mn, float('-inf')) while curr < mx: val = to_optimize(curr) pt = (curr, val) if val > max_pt[1]: max_pt = pt sc.append(pt) curr += stride # call the function to reset the variable to its original value to_optimize(prev) inverted_maxima.append((max_pt[1], max_pt[0], sc.index(max_pt), i)) score_lists.append(sc) inverted_maxima.sort(reverse=True) maxima = [(i[1], i[0]) for i in inverted_maxima] self.do_plot(score_lists, maxima, x_range=(mn, mx) )
def opt_model_param(self, param, curr_step=0.04): debug('opt_model') return self.call_opt(param, curr_step=curr_step)
def opt_D(self,curr_step=0.04): debug('opt_D') return self.call_opt(self.free_parameters[BranchEnum.D], curr_step=curr_step)
def opt_Internal(self,curr_step=0.04): debug('opt_Internal') return self.call_opt(self.free_parameters[BranchEnum.INTERNAL], curr_step=curr_step)
def prob_vec_updated(self, prob_vec_index): debug("prob_vec_updated(%d)" % prob_vec_index) self.repaint()