Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Side by Side Diff: appengine/findit/crash/scorers/aggregator.py

Issue 1861373003: [Findit] Initial code of findit for crash. Add scorers to apply heuristic rules. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Fix nits and rebase Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 # Copyright 2016 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 """Aggregator aggregates all the scorers passed in.
6
7 Multiplies scores together and combines reasons and summaries the result.
8 """
9
10
11 class Aggregator(object):
12
13 def __init__(self, scorers):
14 self.scorers = scorers
15
16 def ScoreAndReason(self, result):
17 """Sets result.confidence and result.reason."""
18
19 score = 1.0
20 reason = ''
21 for i, scorer in enumerate(self.scorers):
22 current_score, current_reason = scorer(result)
23 # TODO(katesonia): Compare this mutiply aggregator with a vector of scores
24 # aggregator later.
25 score *= current_score
26 reason += '%d. %s (score: %d)\n' % (i + 1, current_reason, current_score)
27
28 reason += '\n%s' % str(result)
29
30 result.confidence = score
31 result.reason = reason
OLDNEW
« no previous file with comments | « appengine/findit/crash/scorers/__init__.py ('k') | appengine/findit/crash/scorers/min_distance.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698