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

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 doc strings. 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, multiplies scores
6 together and combines reasons and summaries the result."""
7
8
9 class Aggregator(object):
10
11 def __init__(self, scorers):
12 self.scorers = scorers
13
14 def ScoreAndReason(self, result):
15 score = 1.0
16 reason = ''
17 for i, scorer in enumerate(self.scorers):
18 curr_score, curr_reason = scorer(result)
stgao 2016/04/15 18:35:19 no abbreviation.
Sharu 2016/04/15 22:59:47 Done.
19 score *= curr_score
stgao 2016/04/15 18:35:19 So we change from a vector of scores to multiplyin
Sharu 2016/04/15 22:59:47 Add a TODO here to compare these 2 methods later.
20 reason += '%d. %s (score: %d)\n' % (i + 1, curr_reason, curr_score)
21
22 reason += '\n%s' % str(result)
23
24 result.confidence = score
25 result.reason = reason
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698