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

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: Address comments. 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 current_score, current_reason = scorer(result)
19 # TODO(katesonia): Compare this mutiply aggregator with a vector of scores
20 # aggregator later.
21 score *= current_score
22 reason += '%d. %s (score: %d)\n' % (i + 1, current_reason, current_score)
23
24 reason += '\n%s' % str(result)
25
26 result.confidence = score
27 result.reason = reason
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698