code: def score_paths(self, paths, agents_values, loss_of_function=False,
                      sigma=0.15, include_final_node=False):
          obs_model = lambda x: scipy.stats.norm(x, sigma)
          obs_dict = {}
          for ag, val in agents_values.items():
              obs_list = self.agent_to_obs[ag]
              if obs_list is not None:
                  for obs in obs_list:
                      obs_dict[obs] = val
          path_scores = []
          for path in paths:
              logger.info('------')
              logger.info("Scoring path:")
              logger.info(path)
              path_score = 0
              last_path_node_index = -1 if include_final_node else -2
              for node, sign in path[:last_path_node_index]:
                  for affected_obs, rule_obs_sign in self.rule_obs_dict[node]:
                      flip_polarity = -1 if loss_of_function else 1
                      pred_sign = sign * rule_obs_sign * flip_polarity
                      logger.info('%s %s: effect %s %s' %
                                  (node, sign, affected_obs, pred_sign))
                      measured_val = obs_dict.get(affected_obs)
                      if measured_val:
                          if pred_sign <= 0:
                              prob_correct = obs_model(measured_val).logcdf(0)
                          else:
                              prob_correct = obs_model(measured_val).logsf(0)
                          logger.info('Actual: %s, Log Probability: %s' %
                                      (measured_val, prob_correct))
                          path_score += prob_correct
                  if not self.rule_obs_dict[node]:
                      logger.info('%s %s' % (node, sign))
                      prob_correct = obs_model(0).logcdf(0)
                      logger.info('Unmeasured node, Log Probability: %s' %
                                  (prob_correct))
                      path_score += prob_correct
              logger.info("Path score: %s" % path_score)
              path_scores.append(path_score)
          path_tuples = list(zip(paths, path_scores))
          sorted_by_length = sorted(path_tuples, key=lambda x: len(x[0]))
          scored_paths = sorted(sorted_by_length, key=lambda x: x[1],
                                reverse=True)
          return scored_paths