def find_final_one(list, g) count = 0 last_precision = 0 last_recall = 0 target = [] list.each do |list| count = (count + g.select { |g| list == g }.count).to_f precision, recall = (count/list.count.to_f).to_f, (count/10).to_f target << list if precision >= last_precision and recall >= last_recall last_precision, last_recall = precision, recall end target end